Skip to content

Commit baa2342

Browse files
committed
Fix transpiled errors that not a constructor
1 parent b1ff03c commit baa2342

File tree

6 files changed

+46
-22
lines changed

6 files changed

+46
-22
lines changed

package-lock.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1880,7 +1880,8 @@
18801880
"svgo": "^4.0.0",
18811881
"tsx": "^4.20.3",
18821882
"typescript": "^5.8.3",
1883-
"winston": "^3.17.0"
1883+
"winston": "^3.17.0",
1884+
"winston-transport": "^4.9.0"
18841885
},
18851886
"dependencies": {
18861887
"@vscode/codicons": "^0.0.38",

src/logging/OutputChannelTransport.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414
import * as vscode from "vscode";
15-
import * as Transport from "winston-transport";
15+
import * as TransportType from "winston-transport";
16+
17+
// Compile error if don't use "require": https://github.com/swiftlang/vscode-swift/actions/runs/16529946578/job/46752753379?pr=1746
18+
// eslint-disable-next-line @typescript-eslint/no-require-imports
19+
const Transport: typeof TransportType = require("winston-transport");
1620

1721
export class OutputChannelTransport extends Transport {
1822
private appending: boolean = false;

src/logging/RollingLog.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414
import * as vscode from "vscode";
15-
import * as Transport from "winston-transport";
1615

1716
export class RollingLog implements vscode.Disposable {
1817
private _logs: (string | null)[];
@@ -79,20 +78,3 @@ export class RollingLog implements vscode.Disposable {
7978
this.logCount = 1;
8079
}
8180
}
82-
83-
export class RollingLogTransport extends Transport {
84-
constructor(private readonly rollingLog: RollingLog) {
85-
super();
86-
this.level = "info"; // This log is used for testing, we
87-
}
88-
89-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
90-
public log(info: any, next: () => void): void {
91-
if (info.append) {
92-
this.rollingLog.append(info.message);
93-
} else {
94-
this.rollingLog.appendLine(info.message);
95-
}
96-
next();
97-
}
98-
}

src/logging/RollingLogTransport.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the VS Code Swift open source project
4+
//
5+
// Copyright (c) 2025 the VS Code Swift project authors
6+
// Licensed under Apache License v2.0
7+
//
8+
// See LICENSE.txt for license information
9+
// See CONTRIBUTORS.txt for the list of VS Code Swift project authors
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
//
13+
//===----------------------------------------------------------------------===//
14+
import * as TransportType from "winston-transport";
15+
import { RollingLog } from "./RollingLog";
16+
17+
// Compile error if don't use "require": https://github.com/swiftlang/vscode-swift/actions/runs/16529946578/job/46752753379?pr=1746
18+
// eslint-disable-next-line @typescript-eslint/no-require-imports
19+
const Transport: typeof TransportType = require("winston-transport");
20+
21+
export class RollingLogTransport extends Transport {
22+
constructor(private rollingLog: RollingLog) {
23+
super();
24+
this.level = "info"; // This log is used for testing, we
25+
}
26+
27+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
28+
public log(info: any, next: () => void): void {
29+
if (info.append) {
30+
this.rollingLog.append(info.message);
31+
} else {
32+
this.rollingLog.appendLine(info.message);
33+
}
34+
next();
35+
}
36+
}

src/logging/SwiftLogger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import * as vscode from "vscode";
1616
import * as winston from "winston";
1717
import { RollingLog } from "./RollingLog";
18-
import { RollingLogTransport } from "./RollingLog";
18+
import { RollingLogTransport } from "./RollingLogTransport";
1919
import { IS_RUNNING_UNDER_TEST } from "../utilities/utilities";
2020
import { OutputChannelTransport } from "./OutputChannelTransport";
2121
import configuration from "../configuration";

0 commit comments

Comments
 (0)