Skip to content

Commit

Permalink
fix: avoid named exports from package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jun 4, 2024
1 parent 0009773 commit e6097ed
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
6 changes: 2 additions & 4 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#!/usr/bin/env node
import { defineCommand, runMain } from "citty";
import { version as nitroVersion } from "nitropack/package.json" with {
type: "json",
};
import nitroPkg from "nitropack/package.json" with { type: "json" };

const main = defineCommand({
meta: {
name: "nitro",
description: "Nitro CLI",
version: nitroVersion,
version: nitroPkg.version,
},
subCommands: {
dev: () => import("./commands/dev").then((r) => r.default),
Expand Down
6 changes: 2 additions & 4 deletions src/core/build/prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import { generateFSTree } from "../utils/fs-tree";
import { writeFile } from "nitropack/kit";
import { scanHandlers } from "../scan";
import type { Nitro, NitroBuildInfo, RollupConfig } from "nitropack/types";
import { version as nitroVersion } from "nitropack/package.json" with {
type: "json",
};
import nitroPkg from "nitropack/package.json" with { type: "json" };
import { snapshotStorage } from "../utils/storage";
import { formatRollupError } from "./error";
import { writeTypes } from "./types";
Expand Down Expand Up @@ -40,7 +38,7 @@ export async function buildProduction(
preset: nitro.options.preset,
framework: nitro.options.framework,
versions: {
nitro: nitroVersion,
nitro: nitroPkg.version,
},
commands: {
preview: nitro.options.commands.preview,
Expand Down
8 changes: 3 additions & 5 deletions src/core/dev-server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
toNodeListener,
} from "h3";
import { createProxyServer, ProxyServerOptions } from "httpxy";
import { listen, Listener, ListenOptions } from "listhen";
import { listen, Listener } from "listhen";
import { servePlaceholder } from "serve-placeholder";
import serveStatic from "serve-static";
import { resolve } from "pathe";
Expand All @@ -29,9 +29,7 @@ import { createVFSHandler } from "./vfs";
import defaultErrorHandler from "./error";
import type { IncomingMessage, OutgoingMessage } from "node:http";
import type { Duplex } from "node:stream";
import { version as nitroVersion } from "nitropack/package.json" with {
type: "json",
};
import nitroPkg from "nitropack/package.json" with { type: "json" };

function initWorker(filename: string): Promise<NitroWorker> | undefined {
if (!existsSync(filename)) {
Expand Down Expand Up @@ -128,7 +126,7 @@ export function createDevServer(nitro: Nitro): NitroDevServer {
preset: nitro.options.preset,
framework: nitro.options.framework,
versions: {
nitro: nitroVersion,
nitro: nitroPkg.version,
},
dev: {
pid: process.pid,
Expand Down

0 comments on commit e6097ed

Please sign in to comment.