nitro-nightly 3.0.1-20251216-111108-9bf11b73 → 3.0.1-20251216-225042-3c7b1a8f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/_nitro.mjs CHANGED
@@ -15,7 +15,7 @@ import { createRequire } from "node:module";
15
15
  import consola$1, { consola } from "consola";
16
16
  import { Hookable, createDebugger } from "hookable";
17
17
  import { existsSync, promises } from "node:fs";
18
- import { joinURL, parseURL, withBase, withLeadingSlash, withTrailingSlash, withoutBase, withoutTrailingSlash } from "ufo";
18
+ import { joinURL, parseURL, withBase, withLeadingSlash, withQuery, withTrailingSlash, withoutBase, withoutTrailingSlash } from "ufo";
19
19
  import { pathToFileURL } from "node:url";
20
20
  import fsp, { readFile } from "node:fs/promises";
21
21
  import { defu } from "defu";
@@ -23,8 +23,8 @@ import { runtimeDir } from "nitro/meta";
23
23
  import { colors } from "consola/utils";
24
24
  import { hash } from "ohash";
25
25
  import zlib from "node:zlib";
26
+ import http from "node:http";
26
27
  import { toRequest } from "h3";
27
- import { ofetch } from "ofetch";
28
28
 
29
29
  //#region src/config/defaults.ts
30
30
  const NitroDefaults = {
@@ -1318,12 +1318,35 @@ async function _getTasksContext(opts) {
1318
1318
  const buildInfo = JSON.parse(await readFile(buildInfoPath, "utf8"));
1319
1319
  if (!buildInfo.dev?.pid || !buildInfo.dev?.workerAddress) throw new Error(`Missing dev server info in: \`${buildInfoPath}\` ${_devHint}`);
1320
1320
  if (!_pidIsRunning(buildInfo.dev.pid)) throw new Error(`Dev server is not running (pid: ${buildInfo.dev.pid})`);
1321
+ const baseURL = `http://${buildInfo.dev.workerAddress.host || "localhost"}:${buildInfo.dev.workerAddress.port || "3000"}`;
1322
+ const socketPath = buildInfo.dev.workerAddress.socketPath;
1323
+ const devFetch = (path, options) => {
1324
+ return new Promise((resolve$1, reject) => {
1325
+ let url = withBase(path, baseURL);
1326
+ if (options?.query) url = withQuery(url, options.query);
1327
+ const request = http.request(url, {
1328
+ socketPath,
1329
+ method: options?.method,
1330
+ headers: {
1331
+ Accept: "application/json",
1332
+ "Content-Type": "application/json"
1333
+ }
1334
+ }, (response) => {
1335
+ if (!response.statusCode || response.statusCode >= 400 && response.statusCode < 600) {
1336
+ reject(new Error(response.statusMessage));
1337
+ return;
1338
+ }
1339
+ let data = "";
1340
+ response.on("data", (chunk) => data += chunk).on("end", () => resolve$1(JSON.parse(data))).on("error", (e) => reject(e));
1341
+ });
1342
+ request.on("error", (e) => reject(e));
1343
+ if (options?.body) request.write(JSON.stringify(options.body));
1344
+ request.end();
1345
+ });
1346
+ };
1321
1347
  return {
1322
1348
  buildInfo,
1323
- devFetch: ofetch.create({
1324
- baseURL: `http://${buildInfo.dev.workerAddress.host || "localhost"}:${buildInfo.dev.workerAddress.port || "3000"}`,
1325
- socketPath: buildInfo.dev.workerAddress.socketPath
1326
- })
1349
+ devFetch
1327
1350
  };
1328
1351
  }
1329
1352
  function _pidIsRunning(pid) {
@@ -50,8 +50,8 @@ var dev_default = defineCommand({
50
50
  });
51
51
  nitro.hooks.hookOnce("restart", reload);
52
52
  await new NitroDevServer(nitro).listen({
53
- port: args.port,
54
- hostname: args.host
53
+ port: args.port || nitro.options.devServer.port,
54
+ hostname: args.host || nitro.options.devServer.hostname
55
55
  });
56
56
  await prepare(nitro);
57
57
  await build(nitro);
@@ -5,7 +5,6 @@ import { IncomingMessage, OutgoingMessage } from "node:http";
5
5
  import { H3Core, HTTPError, HTTPEvent, HTTPHandler, HTTPMethod, Middleware, ProxyOptions } from "h3";
6
6
  import { Duplex } from "node:stream";
7
7
  import { ServerRequest, ServerRequest as ServerRequest$1 } from "srvx";
8
- import { FetchOptions, FetchRequest, FetchResponse } from "ofetch";
9
8
  import { Preset } from "unenv";
10
9
  import { ConnectorName } from "db0";
11
10
  import { BuiltinDriverName } from "unstorage";
@@ -13,6 +12,7 @@ import { JsxOptions, TransformOptions } from "oxc-transform";
13
12
  import { MinifyOptions } from "oxc-minify";
14
13
  import { InputOptions, OutputOptions } from "rollup";
15
14
  import { Nitro as Nitro$1, RunnerMessageListener as RunnerMessageListener$1 } from "nitro/types";
15
+ import { FetchOptions, FetchRequest, FetchResponse } from "ofetch";
16
16
  import { RollupCommonJSOptions } from "@rollup/plugin-commonjs";
17
17
  import { C12InputConfig, ConfigWatcher, DotenvOptions, ResolvedConfig, WatchConfigOptions } from "c12";
18
18
  import { ChokidarOptions } from "chokidar";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-nightly",
3
- "version": "3.0.1-20251216-111108-9bf11b73",
3
+ "version": "3.0.1-20251216-225042-3c7b1a8f",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "homepage": "https://nitro.build",
6
6
  "repository": "nitrojs/nitro",