@logtape/file 0.11.0-dev.175 → 0.12.0-dev.181

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.
Files changed (77) hide show
  1. package/deno.json +37 -0
  2. package/dist/_virtual/rolldown_runtime.cjs +30 -0
  3. package/dist/filesink.base.cjs +81 -0
  4. package/dist/filesink.base.d.cts +98 -0
  5. package/dist/filesink.base.d.cts.map +1 -0
  6. package/dist/filesink.base.d.ts +98 -0
  7. package/dist/filesink.base.d.ts.map +1 -0
  8. package/dist/filesink.base.js +80 -0
  9. package/dist/filesink.base.js.map +1 -0
  10. package/dist/filesink.deno.cjs +67 -0
  11. package/dist/filesink.deno.d.cts +40 -0
  12. package/dist/filesink.deno.d.cts.map +1 -0
  13. package/dist/filesink.deno.d.ts +40 -0
  14. package/dist/filesink.deno.d.ts.map +1 -0
  15. package/dist/filesink.deno.js +66 -0
  16. package/dist/filesink.deno.js.map +1 -0
  17. package/dist/filesink.node.cjs +60 -0
  18. package/{esm/file/filesink.node.js → dist/filesink.node.d.cts} +12 -19
  19. package/dist/filesink.node.d.cts.map +1 -0
  20. package/{types/file → dist}/filesink.node.d.ts +11 -5
  21. package/dist/filesink.node.d.ts.map +1 -0
  22. package/dist/filesink.node.js +58 -0
  23. package/dist/filesink.node.js.map +1 -0
  24. package/dist/mod.cjs +15 -0
  25. package/dist/mod.d.cts +3 -0
  26. package/dist/mod.d.ts +3 -0
  27. package/dist/mod.js +3 -0
  28. package/filesink.base.ts +170 -0
  29. package/filesink.deno.ts +69 -0
  30. package/filesink.jsr.ts +52 -0
  31. package/filesink.node.ts +64 -0
  32. package/filesink.test.ts +224 -0
  33. package/mod.ts +7 -0
  34. package/package.json +37 -25
  35. package/tsdown.config.ts +22 -0
  36. package/esm/file/filesink.base.js +0 -85
  37. package/esm/file/mod.js +0 -1
  38. package/esm/package.json +0 -3
  39. package/script/file/filesink.base.js +0 -89
  40. package/script/file/filesink.node.js +0 -55
  41. package/script/file/mod.js +0 -6
  42. package/script/package.json +0 -3
  43. package/types/_dnt.test_shims.d.ts.map +0 -1
  44. package/types/deps/jsr.io/@david/which-runtime/0.2.1/mod.d.ts.map +0 -1
  45. package/types/deps/jsr.io/@std/assert/0.222.1/_constants.d.ts.map +0 -1
  46. package/types/deps/jsr.io/@std/assert/0.222.1/_diff.d.ts.map +0 -1
  47. package/types/deps/jsr.io/@std/assert/0.222.1/_format.d.ts.map +0 -1
  48. package/types/deps/jsr.io/@std/assert/0.222.1/assert_equals.d.ts.map +0 -1
  49. package/types/deps/jsr.io/@std/assert/0.222.1/assert_is_error.d.ts.map +0 -1
  50. package/types/deps/jsr.io/@std/assert/0.222.1/assert_throws.d.ts.map +0 -1
  51. package/types/deps/jsr.io/@std/assert/0.222.1/assertion_error.d.ts.map +0 -1
  52. package/types/deps/jsr.io/@std/assert/0.222.1/equal.d.ts.map +0 -1
  53. package/types/deps/jsr.io/@std/fmt/0.222.1/colors.d.ts.map +0 -1
  54. package/types/deps/jsr.io/@std/path/1.1.0/_common/assert_path.d.ts.map +0 -1
  55. package/types/deps/jsr.io/@std/path/1.1.0/_common/constants.d.ts.map +0 -1
  56. package/types/deps/jsr.io/@std/path/1.1.0/_common/from_file_url.d.ts.map +0 -1
  57. package/types/deps/jsr.io/@std/path/1.1.0/_common/normalize.d.ts.map +0 -1
  58. package/types/deps/jsr.io/@std/path/1.1.0/_common/normalize_string.d.ts.map +0 -1
  59. package/types/deps/jsr.io/@std/path/1.1.0/_os.d.ts.map +0 -1
  60. package/types/deps/jsr.io/@std/path/1.1.0/join.d.ts.map +0 -1
  61. package/types/deps/jsr.io/@std/path/1.1.0/posix/_util.d.ts.map +0 -1
  62. package/types/deps/jsr.io/@std/path/1.1.0/posix/from_file_url.d.ts.map +0 -1
  63. package/types/deps/jsr.io/@std/path/1.1.0/posix/join.d.ts.map +0 -1
  64. package/types/deps/jsr.io/@std/path/1.1.0/posix/normalize.d.ts.map +0 -1
  65. package/types/deps/jsr.io/@std/path/1.1.0/windows/_util.d.ts.map +0 -1
  66. package/types/deps/jsr.io/@std/path/1.1.0/windows/from_file_url.d.ts.map +0 -1
  67. package/types/deps/jsr.io/@std/path/1.1.0/windows/join.d.ts.map +0 -1
  68. package/types/deps/jsr.io/@std/path/1.1.0/windows/normalize.d.ts.map +0 -1
  69. package/types/file/filesink.base.d.ts +0 -94
  70. package/types/file/filesink.base.d.ts.map +0 -1
  71. package/types/file/filesink.node.d.ts.map +0 -1
  72. package/types/file/filesink.test.d.ts.map +0 -1
  73. package/types/file/mod.d.ts +0 -3
  74. package/types/file/mod.d.ts.map +0 -1
  75. package/types/logtape/fixtures.d.ts.map +0 -1
  76. package/types/logtape/level.d.ts.map +0 -1
  77. package/types/logtape/record.d.ts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalize_string.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.1.0/_common/normalize_string.ts"],"names":[],"mappings":"AAQA,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,OAAO,EACvB,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GACzC,MAAM,CA4DR"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"_os.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/path/1.1.0/_os.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,SAAS,EAAE,OAIjB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"join.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/path/1.1.0/join.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAEnE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"_util.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.1.0/posix/_util.ts"],"names":[],"mappings":"AAOA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"from_file_url.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.1.0/posix/from_file_url.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,MAAM,CAKrD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"join.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.1.0/posix/join.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,MAAM,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CASpE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.1.0/posix/normalize.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAmBpD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"_util.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.1.0/windows/_util.ts"],"names":[],"mappings":"AAcA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKzD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"from_file_url.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.1.0/windows/from_file_url.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,MAAM,CAYrD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"join.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.1.0/windows/join.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,MAAM,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAqDpE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.1.0/windows/normalize.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CA6GpD"}
@@ -1,94 +0,0 @@
1
- import { type Sink, type StreamSinkOptions } from "@logtape/logtape";
2
- /**
3
- * Options for the {@link getBaseFileSink} function.
4
- */
5
- export type FileSinkOptions = StreamSinkOptions & {
6
- /**
7
- * If `true`, the file is not opened until the first write. Defaults to `false`.
8
- */
9
- lazy?: boolean;
10
- };
11
- /**
12
- * A platform-specific file sink driver.
13
- * @typeParam TFile The type of the file descriptor.
14
- */
15
- export interface FileSinkDriver<TFile> {
16
- /**
17
- * Open a file for appending and return a file descriptor.
18
- * @param path A path to the file to open.
19
- */
20
- openSync(path: string): TFile;
21
- /**
22
- * Write a chunk of data to the file.
23
- * @param fd The file descriptor.
24
- * @param chunk The data to write.
25
- */
26
- writeSync(fd: TFile, chunk: Uint8Array): void;
27
- /**
28
- * Flush the file to ensure that all data is written to the disk.
29
- * @param fd The file descriptor.
30
- */
31
- flushSync(fd: TFile): void;
32
- /**
33
- * Close the file.
34
- * @param fd The file descriptor.
35
- */
36
- closeSync(fd: TFile): void;
37
- }
38
- /**
39
- * Get a platform-independent file sink.
40
- *
41
- * @typeParam TFile The type of the file descriptor.
42
- * @param path A path to the file to write to.
43
- * @param options The options for the sink and the file driver.
44
- * @returns A sink that writes to the file. The sink is also a disposable
45
- * object that closes the file when disposed.
46
- */
47
- export declare function getBaseFileSink<TFile>(path: string, options: FileSinkOptions & FileSinkDriver<TFile>): Sink & Disposable;
48
- /**
49
- * Options for the {@link getBaseRotatingFileSink} function.
50
- */
51
- export interface RotatingFileSinkOptions extends Omit<FileSinkOptions, "lazy"> {
52
- /**
53
- * The maximum bytes of the file before it is rotated. 1 MiB by default.
54
- */
55
- maxSize?: number;
56
- /**
57
- * The maximum number of files to keep. 5 by default.
58
- */
59
- maxFiles?: number;
60
- }
61
- /**
62
- * A platform-specific rotating file sink driver.
63
- */
64
- export interface RotatingFileSinkDriver<TFile> extends FileSinkDriver<TFile> {
65
- /**
66
- * Get the size of the file.
67
- * @param path A path to the file.
68
- * @returns The `size` of the file in bytes, in an object.
69
- */
70
- statSync(path: string): {
71
- size: number;
72
- };
73
- /**
74
- * Rename a file.
75
- * @param oldPath A path to the file to rename.
76
- * @param newPath A path to be renamed to.
77
- */
78
- renameSync(oldPath: string, newPath: string): void;
79
- }
80
- /**
81
- * Get a platform-independent rotating file sink.
82
- *
83
- * This sink writes log records to a file, and rotates the file when it reaches
84
- * the `maxSize`. The rotated files are named with the original file name
85
- * followed by a dot and a number, starting from 1. The number is incremented
86
- * for each rotation, and the maximum number of files to keep is `maxFiles`.
87
- *
88
- * @param path A path to the file to write to.
89
- * @param options The options for the sink and the file driver.
90
- * @returns A sink that writes to the file. The sink is also a disposable
91
- * object that closes the file when disposed.
92
- */
93
- export declare function getBaseRotatingFileSink<TFile>(path: string, options: RotatingFileSinkOptions & RotatingFileSinkDriver<TFile>): Sink & Disposable;
94
- //# sourceMappingURL=filesink.base.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filesink.base.d.ts","sourceRoot":"","sources":["../../src/file/filesink.base.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,IAAI,EACT,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAC;AAE1B;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG;IAChD;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,cAAc,CAAC,KAAK;IACnC;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IAE9B;;;;OAIG;IACH,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IAE9C;;;OAGG;IACH,SAAS,CAAC,EAAE,EAAE,KAAK,GAAG,IAAI,CAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,EAAE,KAAK,GAAG,IAAI,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,KAAK,EACnC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,GAC/C,IAAI,GAAG,UAAU,CAiBnB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;IAC5E;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,KAAK,CAAE,SAAQ,cAAc,CAAC,KAAK,CAAC;IAC1E;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAEzC;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACpD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAC3C,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,uBAAuB,GAAG,sBAAsB,CAAC,KAAK,CAAC,GAC/D,IAAI,GAAG,UAAU,CAwCnB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"filesink.node.d.ts","sourceRoot":"","sources":["../../src/file/filesink.node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EACL,KAAK,eAAe,EAGpB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,sBAAsB,CAAC,MAAM,GAAG,IAAI,CAS5D,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,eAAoB,GAC5B,IAAI,GAAG,UAAU,CAEnB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,uBAA4B,GACpC,IAAI,GAAG,UAAU,CAEnB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"filesink.test.d.ts","sourceRoot":"","sources":["../../src/file/filesink.test.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export type { FileSinkDriver, FileSinkOptions, RotatingFileSinkDriver, RotatingFileSinkOptions, } from "./filesink.base.js";
2
- export { getFileSink, getRotatingFileSink } from "./filesink.node.js";
3
- //# sourceMappingURL=mod.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/file/mod.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/logtape/fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,IAAI,EAAE,SAOlB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,SAGnB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,SAGrB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,SAGnB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,SAGnB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"level.d.ts","sourceRoot":"","sources":["../../src/logtape/level.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,SAAS,yDAA0D,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;AAEhD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAYrD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,QAAQ,CAW3D;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,CAUhE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/logtape/record.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IAEzB;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,OAAO,EAAE,CAAC;IAErC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,oBAAoB,CAAC;IAEnD;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC9C"}