Skip to content

Commit 1334102

Browse files
authored
remove unnecessary node:os usage (#10856)
1 parent 196ccbf commit 1334102

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

.changeset/whole-pots-read.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"miniflare": patch
3+
"wrangler": patch
4+
---
5+
6+
Removes unnecessary calls to "node:os"

packages/miniflare/src/plugins/core/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import assert from "assert";
22
import { readFileSync } from "fs";
33
import fs from "fs/promises";
4-
import { platform } from "node:os";
54
import path from "path";
65
import { Readable } from "stream";
76
import tls from "tls";
@@ -1085,7 +1084,7 @@ function getContainerEngine(
10851084
if (!engineOrSocketPath) {
10861085
// TODO: workerd does not support win named pipes
10871086
engineOrSocketPath =
1088-
platform() === "win32"
1087+
process.platform === "win32"
10891088
? "//./pipe/docker_engine"
10901089
: "unix:///var/run/docker.sock";
10911090
}

packages/wrangler/src/dev/inspect.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { readFileSync } from "fs";
2-
import os from "node:os";
32
import { fileURLToPath, URL } from "node:url";
43
import path from "path";
54
import open from "open";
@@ -265,7 +264,7 @@ export const openInspector = async (
265264

266265
// see: https://github.com/sindresorhus/open/issues/177#issue-610016699
267266
let braveBrowser: string;
268-
switch (os.platform()) {
267+
switch (process.platform) {
269268
case "darwin":
270269
case "win32":
271270
braveBrowser = "Brave";

packages/wrangler/src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import assert from "node:assert";
2-
import os from "node:os";
32
import { resolve } from "node:path";
43
import { setTimeout } from "node:timers/promises";
54
import { checkMacOSVersion, setLogLevel } from "@cloudflare/cli";
@@ -1722,7 +1721,7 @@ export async function main(argv: string[]): Promise<void> {
17221721
// https://github.com/vadimdemedes/ink/blob/546fe16541fd05ad4e638d6842ca4cbe88b4092b/src/components/App.tsx#L138-L148
17231722
mayReport = false;
17241723

1725-
const currentPlatform = os.platform();
1724+
const currentPlatform = process.platform;
17261725

17271726
const thisTerminalIsUnsupported =
17281727
"This terminal doesn't support raw mode.";

packages/wrangler/src/metrics/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export function getWranglerVersion() {
66
}
77
// used by "new" metrics
88
export function getPlatform() {
9-
const platform = os.platform();
9+
const platform = process.platform;
1010

1111
switch (platform) {
1212
case "win32":

0 commit comments

Comments
 (0)