Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: builder-util-runtime, separate newError to eliminate circular dependency #8251

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/quiet-jars-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"builder-util-runtime": patch
---

Refactored to resolve circular dependency, eliminating warnings from tools such as Rollup
5 changes: 5 additions & 0 deletions packages/builder-util-runtime/src/error.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export function newError(message: string, code: string) {
const error = new Error(message)
;(error as NodeJS.ErrnoException).code = code
return error
}
2 changes: 1 addition & 1 deletion packages/builder-util-runtime/src/httpExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Socket } from "net"
import { Transform } from "stream"
import { URL } from "url"
import { CancellationToken } from "./CancellationToken"
import { newError } from "./index"
import { newError } from "./error"
import { ProgressCallbackTransform, ProgressInfo } from "./ProgressCallbackTransform"

const debug = _debug("electron-builder")
Expand Down
7 changes: 1 addition & 6 deletions packages/builder-util-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export { UUID } from "./uuid"
export { ProgressCallbackTransform, ProgressInfo } from "./ProgressCallbackTransform"
export { parseXml, XElement } from "./xml"
export { BlockMap } from "./blockMapApi"
export { newError } from "./error"

// nsis
export const CURRENT_APP_INSTALLER_FILE_NAME = "installer.exe"
Expand All @@ -50,9 +51,3 @@ export function asArray<T>(v: null | undefined | T | Array<T>): Array<T> {
return [v]
}
}

export function newError(message: string, code: string) {
const error = new Error(message)
;(error as NodeJS.ErrnoException).code = code
return error
}
2 changes: 1 addition & 1 deletion packages/builder-util-runtime/src/uuid.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createHash, randomBytes } from "crypto"
import { newError } from "./index"
import { newError } from "./error"

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

Expand Down
2 changes: 1 addition & 1 deletion packages/builder-util-runtime/src/xml.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as sax from "sax"
import { newError } from "./index"
import { newError } from "./error"

export class XElement {
value = ""
Expand Down
Loading