Skip to content

Commit 140e2f0

Browse files
fix(refactor): builder-util-runtime, separate newError to eliminate circular dependency (#8251)
1 parent 13e0e0d commit 140e2f0

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

.changeset/quiet-jars-leave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"builder-util-runtime": patch
3+
---
4+
5+
Refactored to resolve circular dependency, eliminating warnings from tools such as Rollup
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export function newError(message: string, code: string) {
2+
const error = new Error(message)
3+
;(error as NodeJS.ErrnoException).code = code
4+
return error
5+
}

packages/builder-util-runtime/src/httpExecutor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Socket } from "net"
66
import { Transform } from "stream"
77
import { URL } from "url"
88
import { CancellationToken } from "./CancellationToken"
9-
import { newError } from "./index"
9+
import { newError } from "./error"
1010
import { ProgressCallbackTransform, ProgressInfo } from "./ProgressCallbackTransform"
1111

1212
const debug = _debug("electron-builder")

packages/builder-util-runtime/src/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export { UUID } from "./uuid"
3535
export { ProgressCallbackTransform, ProgressInfo } from "./ProgressCallbackTransform"
3636
export { parseXml, XElement } from "./xml"
3737
export { BlockMap } from "./blockMapApi"
38+
export { newError } from "./error"
3839

3940
// nsis
4041
export const CURRENT_APP_INSTALLER_FILE_NAME = "installer.exe"
@@ -50,9 +51,3 @@ export function asArray<T>(v: null | undefined | T | Array<T>): Array<T> {
5051
return [v]
5152
}
5253
}
53-
54-
export function newError(message: string, code: string) {
55-
const error = new Error(message)
56-
;(error as NodeJS.ErrnoException).code = code
57-
return error
58-
}

packages/builder-util-runtime/src/uuid.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createHash, randomBytes } from "crypto"
2-
import { newError } from "./index"
2+
import { newError } from "./error"
33

44
const invalidName = "options.name must be either a string or a Buffer"
55

packages/builder-util-runtime/src/xml.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as sax from "sax"
2-
import { newError } from "./index"
2+
import { newError } from "./error"
33

44
export class XElement {
55
value = ""

0 commit comments

Comments
 (0)