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

fix: bun dev compatibility #1702

Merged
merged 2 commits into from
Sep 7, 2023
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
6 changes: 3 additions & 3 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env node
import { defineCommand, runMain } from "citty";
import { version } from "../../package.json";
import nitroPkg from "../../package.json";

const main = defineCommand({
meta: {
name: "nitro",
name: nitroPkg.name,
description: "Nitro CLI",
version,
version: nitroPkg.version,
},
subCommands: {
dev: () => import("./commands/dev").then((r) => r.default),
Expand Down
4 changes: 2 additions & 2 deletions src/presets/netlify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { existsSync, promises as fsp } from "node:fs";
import { join, dirname } from "pathe";
import { defineNitroPreset } from "../preset";
import type { Nitro } from "../types";
import { name, version } from "../../package.json";
import nitroPkg from "../../package.json";

// Netlify functions
export const netlify = defineNitroPreset({
Expand Down Expand Up @@ -80,7 +80,7 @@ export const netlifyEdge = defineNitroPreset({
path: "/*",
name: "nitro server handler",
function: "server",
generator: `${name}@${version}`,
generator: `${nitroPkg.name}@${nitroPkg.version}`,
},
],
};
Expand Down
6 changes: 3 additions & 3 deletions src/rollup/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { hash } from "ohash";
import type { Nitro, NitroStaticBuildFlags } from "../types";
import { resolveAliases } from "../utils";
import { runtimeDir } from "../dirs";
import { version } from "../../package.json";
import nitroPkg from "../../package.json";
import { nitroRuntimeDependencies } from "../deps";
import { replace } from "./plugins/replace";
import { virtual } from "./plugins/virtual";
Expand Down Expand Up @@ -177,8 +177,8 @@ export const getRollupConfig = (nitro: Nitro): RollupConfig => {
client: false,
nitro: true,
// @ts-expect-error
"versions.nitro": version,
"versions?.nitro": version,
"versions.nitro": nitroPkg.version,
"versions?.nitro": nitroPkg.version,
// Internal
_asyncContext: nitro.options.experimental.asyncContext,
};
Expand Down
8 changes: 6 additions & 2 deletions src/runtime/entries/nitro-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ import { trapUnhandledNodeErrors } from "../utils";
const server = new Server(toNodeListener(nitroApp.h3App));

function getAddress() {
if (provider === "stackblitz" || process.env.NITRO_NO_UNIX_SOCKET) {
return "0";
if (
provider === "stackblitz" ||
process.env.NITRO_NO_UNIX_SOCKET ||
process.versions.bun
) {
return 0;
}
const socketName = `worker-${process.pid}-${threadId}.sock`;
if (isWindows) {
Expand Down