diff --git a/.changeset/quiet-jars-leave.md b/.changeset/quiet-jars-leave.md new file mode 100644 index 00000000000..3ae5e99ad7d --- /dev/null +++ b/.changeset/quiet-jars-leave.md @@ -0,0 +1,5 @@ +--- +"builder-util-runtime": patch +--- + +Refactored to resolve circular dependency, eliminating warnings from tools such as Rollup diff --git a/packages/builder-util-runtime/src/error.ts b/packages/builder-util-runtime/src/error.ts new file mode 100644 index 00000000000..b865c11f40b --- /dev/null +++ b/packages/builder-util-runtime/src/error.ts @@ -0,0 +1,5 @@ +export function newError(message: string, code: string) { + const error = new Error(message) + ;(error as NodeJS.ErrnoException).code = code + return error +} diff --git a/packages/builder-util-runtime/src/httpExecutor.ts b/packages/builder-util-runtime/src/httpExecutor.ts index 74cd971e25a..0da8772e70b 100644 --- a/packages/builder-util-runtime/src/httpExecutor.ts +++ b/packages/builder-util-runtime/src/httpExecutor.ts @@ -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") diff --git a/packages/builder-util-runtime/src/index.ts b/packages/builder-util-runtime/src/index.ts index b3d845ac8de..c29ea8b48ff 100644 --- a/packages/builder-util-runtime/src/index.ts +++ b/packages/builder-util-runtime/src/index.ts @@ -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" @@ -50,9 +51,3 @@ export function asArray(v: null | undefined | T | Array): Array { return [v] } } - -export function newError(message: string, code: string) { - const error = new Error(message) - ;(error as NodeJS.ErrnoException).code = code - return error -} diff --git a/packages/builder-util-runtime/src/uuid.ts b/packages/builder-util-runtime/src/uuid.ts index 7e9a4982b7f..e5a1b7fd243 100644 --- a/packages/builder-util-runtime/src/uuid.ts +++ b/packages/builder-util-runtime/src/uuid.ts @@ -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" diff --git a/packages/builder-util-runtime/src/xml.ts b/packages/builder-util-runtime/src/xml.ts index 418e15c9977..78d2daa2b44 100644 --- a/packages/builder-util-runtime/src/xml.ts +++ b/packages/builder-util-runtime/src/xml.ts @@ -1,5 +1,5 @@ import * as sax from "sax" -import { newError } from "./index" +import { newError } from "./error" export class XElement { value = ""