Skip to content

Commit e11ec18

Browse files
committed
Merge tag '1.1.2'
LogTape 1.1.2
2 parents 0deb84f + d919d23 commit e11ec18

5 files changed

Lines changed: 50 additions & 7 deletions

File tree

CHANGES.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ To be released.
4343
[#86]: https://github.com/dahlia/logtape/issues/86
4444

4545

46+
Version 1.1.2
47+
-------------
48+
49+
Released on October 22, 2025.
50+
51+
- Fixed Vercel Edge Runtime compatibility issue where LogTape caused
52+
"Node.js API is used (process.on) which is not supported in the Edge
53+
Runtime" error during configuration. Implemented defense-in-depth approach
54+
with both `EdgeRuntime` global variable detection and dynamic bracket
55+
notation access (`proc?.["on"]`) to avoid static analysis detection while
56+
ensuring runtime safety. [[#92]]
57+
58+
4659
Version 1.1.1
4760
-------------
4861

@@ -120,6 +133,29 @@ Released on September 11, 2025.
120133
[#80]: https://github.com/dahlia/logtape/pull/80
121134

122135

136+
Version 1.0.6
137+
-------------
138+
139+
Released on October 22, 2025.
140+
141+
- Fixed Vercel Edge Runtime compatibility issue where LogTape caused
142+
"Node.js API is used (process.on) which is not supported in the Edge
143+
Runtime" error during configuration. Implemented defense-in-depth approach
144+
with both `EdgeRuntime` global variable detection and dynamic bracket
145+
notation access (`proc?.["on"]`) to avoid static analysis detection while
146+
ensuring runtime safety. [[#92]]
147+
148+
- Changed `getStreamFileSink()` in *@logtape/file* package to return
149+
`Sink & AsyncDisposable` instead of `Sink & Disposable` for proper
150+
asynchronous stream cleanup. The previous synchronous disposal did not wait
151+
for streams to finish flushing data to disk, causing incomplete writes in
152+
high-volume logging scenarios and resource leaks. The new async disposal
153+
properly waits for both the stream 'finish' event and file handle closure,
154+
ensuring all data is written and resources are cleaned up correctly.
155+
156+
[#92]: https://github.com/dahlia/logtape/issues/92
157+
158+
123159
Version 1.0.5
124160
-------------
125161

deno.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"exclude": [
3434
"**/.test-report.xml",
3535
".cov/",
36+
".enricomi-publish-action-pip/",
3637
".github/",
3738
".test-report.xml",
3839
"coverage/",

packages/file/src/streamfilesink.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ test("getStreamFileSink() disposal stops writing", async () => {
138138
sink(info);
139139
sink(warning);
140140

141-
await delay(50);
142-
143141
const content = fs.readFileSync(path, { encoding: "utf-8" });
144142
const lines = content.split("\n").filter((line) => line.length > 0);
145143
assertEquals(lines.length, 1); // Only debug record

packages/file/src/streamfilesink.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ export interface StreamFileSinkOptions {
9191
* if it doesn't exist, or appended to if it does exist.
9292
* @param options Configuration options for the stream-based sink.
9393
* @returns A sink that writes formatted log records to the specified file.
94-
* The returned sink implements `Disposable` for proper resource cleanup.
94+
* The returned sink implements `AsyncDisposable` for proper resource cleanup
95+
* that waits for all data to be flushed to disk.
9596
*
9697
* @since 1.0.0
9798
*/

packages/logtape/src/config.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,14 +301,21 @@ function configureInternal<
301301
if (Symbol.dispose in filter) disposables.add(filter as Disposable);
302302
}
303303

304-
if ("process" in globalThis && !("Deno" in globalThis)) {
304+
if (
305+
// deno-lint-ignore no-explicit-any
306+
typeof (globalThis as any).EdgeRuntime !== "string" &&
307+
"process" in globalThis &&
308+
!("Deno" in globalThis)
309+
) {
305310
// deno-lint-ignore no-explicit-any
306311
const proc = (globalThis as any).process;
307-
if (proc?.on) {
308-
proc.on("exit", allowAsync ? dispose : disposeSync);
312+
// Use bracket notation to avoid static analysis detection in Edge Runtime
313+
const onMethod = proc?.["on"];
314+
if (typeof onMethod === "function") {
315+
onMethod.call(proc, "exit", allowAsync ? dispose : disposeSync);
309316
}
310317
} else {
311-
// @ts-ignore: It's fine to addEventListener() on the browser/Deno
318+
// @ts-ignore: It's fine to addEventListener() on the browser/Deno/Edge Runtime
312319
addEventListener("unload", allowAsync ? dispose : disposeSync);
313320
}
314321
const meta = LoggerImpl.getLogger(["logtape", "meta"]);

0 commit comments

Comments
 (0)