From e7cb255b035e97ba9896bfe3e13f61bf21754487 Mon Sep 17 00:00:00 2001 From: bobzilladev Date: Thu, 11 Apr 2024 14:59:30 -0400 Subject: [PATCH] update next.js to 14 --- __test__/online.spec.mjs | 4 ++-- examples/nextjs/ngrok.config.js | 9 ++++--- examples/nextjs/package.json | 2 +- flake.lock | 42 +++++++++++++++++++++++---------- src/listener_builder.rs | 7 ------ src/session.rs | 2 +- 6 files changed, 38 insertions(+), 28 deletions(-) diff --git a/__test__/online.spec.mjs b/__test__/online.spec.mjs index 5422fb4..6010bf5 100644 --- a/__test__/online.spec.mjs +++ b/__test__/online.spec.mjs @@ -137,7 +137,7 @@ test("tls backend", async (t) => { { instanceOf: AxiosError } ); t.is(421, error.response.status); - t.truthy(error.response.headers["ngrok-trace-id"]); + t.truthy(error.response.data.includes("different Host")); await listener.close(); }); @@ -153,7 +153,7 @@ test("unverified tls backend", async (t) => { { instanceOf: AxiosError } ); t.is(421, error.response.status); - t.truthy(error.response.headers["ngrok-trace-id"]); + t.truthy(error.response.data.includes("different Host")); await listener.close(); }); diff --git a/examples/nextjs/ngrok.config.js b/examples/nextjs/ngrok.config.js index a3498de..7235d44 100644 --- a/examples/nextjs/ngrok.config.js +++ b/examples/nextjs/ngrok.config.js @@ -1,14 +1,13 @@ const ngrok = require("@ngrok/ngrok"); -// setup ngrok ingress in the parent process -var makeListener = true; + +// setup ngrok ingress in the parent process, +// in forked processes "send" will exist. +const makeListener = process.send === undefined; var host = "localhost"; var port = process.env.PORT || "3000"; process.argv.forEach((item, index) => { - // The first process to configure is a child which runs building, then the parent - // configures later, so use arguments rather than environment variable to run once. - if (item.includes("processChild")) makeListener = false; if (["--hostname", "-H"].includes(item)) host = process.argv[index + 1]; if (["--port", "-p"].includes(item)) port = process.argv[index + 1]; }); diff --git a/examples/nextjs/package.json b/examples/nextjs/package.json index 2ee4adb..1caa517 100644 --- a/examples/nextjs/package.json +++ b/examples/nextjs/package.json @@ -1,6 +1,6 @@ { "dependencies": { "@ngrok/ngrok": "^1.*", - "next": "13.3.0" + "next": "14.0.4" } } diff --git a/flake.lock b/flake.lock index 8de1923..8c65932 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1674541370, - "narHash": "sha256-L62dKDX6fIUQhlna9R8PKSAEGZ7ueU5gRGxZzZs/Zx8=", + "lastModified": 1712816664, + "narHash": "sha256-kPIVs2ATag+gm1CiWCJ+qcVQVR89w2eh/Cg4g1Xph70=", "owner": "nix-community", "repo": "fenix", - "rev": "4435f8e9da13581e51ba1f92a25d7d54c776ad94", + "rev": "94f8df6a8e52447af72a1a0008eccf4a099b6d25", "type": "github" }, "original": { @@ -22,12 +22,15 @@ } }, "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -38,11 +41,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1674457414, - "narHash": "sha256-HGoDKtOXIKvU72/4gL3VUYla/YExhS0oPoiIuDjlTrg=", + "lastModified": 1712757991, + "narHash": "sha256-kR7C7Fqt3JP40h0mzmSZeWI5pk1iwqj4CSeGjnUbVHc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f32319e7ba8f03ea2f1c66a5ffe43b4e771108f5", + "rev": "d6b3ddd253c578a7ab98f8011e59990f21dc3932", "type": "github" }, "original": { @@ -62,11 +65,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1674491573, - "narHash": "sha256-1hMPOn2dlMfWRWvuaWcSxNquKpvjGVXq2rVw6UJy75Q=", + "lastModified": 1712663608, + "narHash": "sha256-tN9ZL6kGppmHg84lxlpAlaN+kXWNctKK7Yitq/iXDEw=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "c552e5a55f13b2f08d506bb46fb74dbc11702d0d", + "rev": "a5feb4f05f09adca661c869b1bf2324898cbaa43", "type": "github" }, "original": { @@ -75,6 +78,21 @@ "repo": "rust-analyzer", "type": "github" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/src/listener_builder.rs b/src/listener_builder.rs index 624be67..6f0d864 100644 --- a/src/listener_builder.rs +++ b/src/listener_builder.rs @@ -6,13 +6,6 @@ use std::{ use napi::bindgen_prelude::*; use napi_derive::napi; use ngrok::{ - config::{ - HttpTunnelBuilder, - LabeledTunnelBuilder, - ProxyProto, - TcpTunnelBuilder, - TlsTunnelBuilder, - }, prelude::*, Session, }; diff --git a/src/session.rs b/src/session.rs index 60ea89b..7e1ba12 100644 --- a/src/session.rs +++ b/src/session.rs @@ -83,7 +83,7 @@ pub(crate) struct SessionBuilder { } #[napi] -#[cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))] +#[cfg_attr(feature = "clippy", allow(clippy::new_without_default))] #[allow(dead_code)] impl SessionBuilder { /// Create a new session builder