From 755242f02b60549833444e7683628cf0ad87cdcf Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Thu, 22 Aug 2024 22:23:17 +0200 Subject: [PATCH 01/13] chore!: esm only (#306) BREAKING CHANGE: This package has now migrated to ESM only Co-authored-by: wolfy1339 --- .github/workflows/ci.yml | 1 - README.md | 2 +- index.ts | 4 +- package-lock.json | 89 +++++++++++++++------------------------- package.json | 6 +-- test/index.test.ts | 2 +- tsconfig.json | 4 +- 7 files changed, 42 insertions(+), 66 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb8e7e7..81968bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,7 +94,6 @@ jobs: node-version: - 18 - 20 - - 21 - 22 os: - ubuntu-latest diff --git a/README.md b/README.md index d1f8e28..c3d39dc 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Run `smee --help` for usage. ### Node Client ```js -const SmeeClient = require('smee-client') +import SmeeClient from 'smee-client' const smee = new SmeeClient({ source: 'https://smee.io/abc123', diff --git a/index.ts b/index.ts index b4442a2..066c3e6 100644 --- a/index.ts +++ b/index.ts @@ -1,5 +1,5 @@ import validator from "validator"; -import EventSource from "eventsource"; +import { EventSource } from "undici"; import url from "url"; import querystring from "querystring"; @@ -111,4 +111,4 @@ class Client { } } -export = Client; +export default Client; diff --git a/package-lock.json b/package-lock.json index 17e062e..bebe9c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": { "commander": "^12.0.0", - "eventsource": "^2.0.2", + "undici": "6.19.8", "validator": "^13.11.0" }, "bin": { @@ -18,8 +18,7 @@ }, "devDependencies": { "@octokit/tsconfig": "^3.0.0", - "@types/eventsource": "^1.1.15", - "@types/node": "^20.0.0", + "@types/node": "^18.19.14", "@types/validator": "^13.11.6", "@vitest/coverage-v8": "^2.0.0", "fastify": "^4.24.3", @@ -63,13 +62,13 @@ } }, "node_modules/@babel/parser": { - "version": "7.25.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.3.tgz", - "integrity": "sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw==", + "version": "7.25.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.4.tgz", + "integrity": "sha512-nq+eWrOgdtu3jG5Os4TQP3x3cLA8hR8TvJNjD8vnPa20WGycimcparWnLK4jJhElTK6SDyuJo1weMKO/5LpmLA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.25.2" + "@babel/types": "^7.25.4" }, "bin": { "parser": "bin/babel-parser.js" @@ -79,9 +78,9 @@ } }, "node_modules/@babel/types": { - "version": "7.25.2", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.2.tgz", - "integrity": "sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q==", + "version": "7.25.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.4.tgz", + "integrity": "sha512-zQ1ijeeCXVEh+aNL0RlmkPkG8HUiDcU2pzQQFjtbntgAczRASFzj4H+6+bV+dy1ntKR14I/DypeuRG1uma98iQ==", "dev": true, "license": "MIT", "dependencies": { @@ -665,7 +664,6 @@ "arm64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ "darwin" @@ -847,7 +845,6 @@ "x64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ "win32" @@ -860,21 +857,14 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/eventsource": { - "version": "1.1.15", - "resolved": "https://registry.npmjs.org/@types/eventsource/-/eventsource-1.1.15.tgz", - "integrity": "sha512-XQmGcbnxUNa06HR3VBVkc9+A2Vpi9ZyLJcdS5dwaQQ/4ZMWFO+5c90FnMUpbtMZwB/FChoYHwuVg8TvkECacTA==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/node": { - "version": "20.16.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.0.tgz", - "integrity": "sha512-vDxceJcoZhIVh67S568bm1UGZO0DX0hpplJZxzeXMKwIPLn190ec5RRxQ69BKhX44SUGIxxgMdDY557lGLKprQ==", + "version": "18.19.45", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.45.tgz", + "integrity": "sha512-VZxPKNNhjKmaC1SUYowuXSRSMGyQGmQjvvA1xE4QZ0xce2kLtEhPDS+kqpCPBZYgqblCLQ2DAjSzmgCM5auvhA==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~6.19.2" + "undici-types": "~5.26.4" } }, "node_modules/@types/validator": { @@ -1382,15 +1372,6 @@ "node": ">=0.8.x" } }, - "node_modules/eventsource": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", - "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", - "license": "MIT", - "engines": { - "node": ">=12.0.0" - } - }, "node_modules/execa": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", @@ -1584,21 +1565,6 @@ "node": ">= 0.6" } }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/get-func-name": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", @@ -2630,9 +2596,9 @@ "license": "MIT" }, "node_modules/tinypool": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.0.0.tgz", - "integrity": "sha512-KIKExllK7jp3uvrNtvRBYBWBOAXSX8ZvoaD8T+7KB/QHIuoJW3Pmr60zucywjAlMb5TeXUkcs/MWeWLu0qvuAQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.0.1.tgz", + "integrity": "sha512-URZYihUbRPcGv95En+sz6MfghfIc2OJ1sv/RmhWZLouPY0/8Vo80viwPvg3dlaS9fuq7fQMEfgRRK7BBZThBEA==", "dev": true, "license": "MIT", "engines": { @@ -2693,10 +2659,19 @@ "node": ">=14.17" } }, + "node_modules/undici": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.19.8.tgz", + "integrity": "sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==", + "license": "MIT", + "engines": { + "node": ">=18.17" + } + }, "node_modules/undici-types": { - "version": "6.19.6", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.6.tgz", - "integrity": "sha512-e/vggGopEfTKSvj4ihnOLTsqhrKRN3LeO6qSN/GxohhuRv8qH9bNQ4B8W7e/vFL+0XTnmHPB4/kegunZGA4Org==", + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", "dev": true, "license": "MIT" }, @@ -2710,15 +2685,15 @@ } }, "node_modules/vite": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.1.tgz", - "integrity": "sha512-1oE6yuNXssjrZdblI9AfBbHCC41nnyoVoEZxQnID6yvQZAFBzxxkqoFLtHUMkYunL8hwOLEjgTuxpkRxvba3kA==", + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.2.tgz", + "integrity": "sha512-dDrQTRHp5C1fTFzcSaMxjk6vdpKvT+2/mIdE07Gw2ykehT49O0z/VHS3zZ8iV/Gh8BJJKHWOe5RjaNrW5xf/GA==", "dev": true, "license": "MIT", "dependencies": { "esbuild": "^0.21.3", "postcss": "^8.4.41", - "rollup": "^4.13.0" + "rollup": "^4.20.0" }, "bin": { "vite": "bin/vite.js" diff --git a/package.json b/package.json index bcc8f28..c6e1475 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.0.0-development", "description": "Client to proxy webhooks to localhost", "main": "index.js", + "type": "module", "bin": { "smee": "./bin/smee.js" }, @@ -24,13 +25,12 @@ "license": "ISC", "dependencies": { "commander": "^12.0.0", - "eventsource": "^2.0.2", + "undici": "6.19.8", "validator": "^13.11.0" }, "devDependencies": { "@octokit/tsconfig": "^3.0.0", - "@types/eventsource": "^1.1.15", - "@types/node": "^20.0.0", + "@types/node": "^18.19.14", "@types/validator": "^13.11.6", "@vitest/coverage-v8": "^2.0.0", "fastify": "^4.24.3", diff --git a/test/index.test.ts b/test/index.test.ts index 6dc6672..7147f4c 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -1,4 +1,4 @@ -import Client from "../index"; +import Client from "../index.ts"; import { describe, test, expect } from "vitest"; import { fastify as Fastify } from "fastify"; diff --git a/tsconfig.json b/tsconfig.json index 2b8c93d..019a301 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,7 @@ "extends": "@octokit/tsconfig", "compilerOptions": { + "module": "ES2020", "verbatimModuleSyntax": false, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, @@ -13,7 +14,8 @@ "esModuleInterop": true, "declaration": true, "allowJs": true, - "lib": ["es2023", "dom"] + "lib": ["es2023", "dom"], + "moduleResolution": "Node" }, "include": ["./*"], "files": ["index.ts"] From eae4aba2615993149db1d0957b66f5d24e8d745a Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Thu, 22 Aug 2024 16:35:07 -0400 Subject: [PATCH 02/13] build(tsconfig): de-duplicate options --- tsconfig.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 019a301..67caaea 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,8 +2,6 @@ "extends": "@octokit/tsconfig", "compilerOptions": { - "module": "ES2020", - "verbatimModuleSyntax": false, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "pretty": true, @@ -14,8 +12,6 @@ "esModuleInterop": true, "declaration": true, "allowJs": true, - "lib": ["es2023", "dom"], - "moduleResolution": "Node" }, "include": ["./*"], "files": ["index.ts"] From a47e91ef4d4c23bbe026ccbe54fe2b47d753d0b8 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Thu, 22 Aug 2024 16:37:12 -0400 Subject: [PATCH 03/13] style: prettier --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 67caaea..62938d7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ "noImplicitAny": true, "esModuleInterop": true, "declaration": true, - "allowJs": true, + "allowJs": true }, "include": ["./*"], "files": ["index.ts"] From b0247a1da9557a75594ec445c3cb017ff193af0d Mon Sep 17 00:00:00 2001 From: wolfy1339 <4595477+wolfy1339@users.noreply.github.com> Date: Thu, 22 Aug 2024 20:13:13 -0400 Subject: [PATCH 04/13] feat: add proxy support by leveraging EnvHttpProxyAgent from undici (#299) Fixes #194 --------- Co-authored-by: Aras Abbasi --- README.md | 4 ++++ index.ts | 22 +++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c3d39dc..79d5dfb 100644 --- a/README.md +++ b/README.md @@ -40,3 +40,7 @@ const events = smee.start() // Stop forwarding events events.close() ``` + +#### Proxy Servers + +By default, the `SmeeClient` API client makes use of the standard proxy server environment variables. diff --git a/index.ts b/index.ts index 066c3e6..1df3ed8 100644 --- a/index.ts +++ b/index.ts @@ -1,5 +1,11 @@ import validator from "validator"; -import { EventSource } from "undici"; +import { + fetch as undiciFetch, + EventSource, + EnvHttpProxyAgent, + type ErrorEvent, + type MessageEvent, +} from "undici"; import url from "url"; import querystring from "querystring"; @@ -23,7 +29,7 @@ class Client { source, target, logger = console, - fetch = global.fetch, + fetch = undiciFetch, }: Options) { this.source = source; this.target = target; @@ -35,10 +41,11 @@ class Client { } } - static async createChannel({ fetch = global.fetch } = {}) { + static async createChannel({ fetch = undiciFetch } = {}) { const response = await fetch("https://smee.io/new", { method: "HEAD", redirect: "manual", + dispatcher: new EnvHttpProxyAgent(), }); const address = response.headers.get("location"); if (!address) { @@ -47,7 +54,7 @@ class Client { return address; } - async onmessage(msg: any) { + async onmessage(msg: MessageEvent) { const data = JSON.parse(msg.data); const target = url.parse(this.target, true); @@ -76,7 +83,6 @@ class Client { const response = await this.fetch(url.format(target), { method: "POST", mode: data["sec-fetch-mode"], - cache: "default", body, headers, }); @@ -90,12 +96,14 @@ class Client { this.logger.info("Connected", this.events.url); } - onerror(err: any) { + onerror(err: ErrorEvent) { this.logger.error(err); } start() { - const events = new EventSource(this.source); + const events = new EventSource(this.source, { + dispatcher: new EnvHttpProxyAgent(), + }); // Reconnect immediately (events as any).reconnectInterval = 0; // This isn't a valid property of EventSource From 2a7f67440031097c874319539f7b775c960aed25 Mon Sep 17 00:00:00 2001 From: wolfy1339 <4595477+wolfy1339@users.noreply.github.com> Date: Fri, 23 Aug 2024 13:30:29 -0400 Subject: [PATCH 05/13] refactor: make class properties private BREAKING CHANGE: class properties are now private --- index.ts | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/index.ts b/index.ts index 1df3ed8..831147e 100644 --- a/index.ts +++ b/index.ts @@ -19,11 +19,11 @@ interface Options { } class Client { - source: string; - target: string; - fetch: typeof global.fetch; - logger: Pick; - events!: EventSource; + #source: string; + #target: string; + #fetch: typeof global.fetch; + #logger: Pick; + #events!: EventSource; constructor({ source, @@ -31,10 +31,10 @@ class Client { logger = console, fetch = undiciFetch, }: Options) { - this.source = source; - this.target = target; - this.logger = logger!; - this.fetch = fetch; + this.#source = source; + this.#target = target; + this.#logger = logger!; + this.#fetch = fetch; if (!validator.isURL(this.source)) { throw new Error("The provided URL is invalid."); @@ -57,7 +57,7 @@ class Client { async onmessage(msg: MessageEvent) { const data = JSON.parse(msg.data); - const target = url.parse(this.target, true); + const target = url.parse(this.#target, true); const mergedQuery = { ...target.query, ...data.query }; target.search = querystring.stringify(mergedQuery); @@ -80,28 +80,28 @@ class Client { headers["content-type"] = "application/json"; try { - const response = await this.fetch(url.format(target), { + const response = await this.#fetch(url.format(target), { method: "POST", mode: data["sec-fetch-mode"], body, headers, }); - this.logger.info(`POST ${response.url} - ${response.status}`); + this.#logger.info(`POST ${response.url} - ${response.status}`); } catch (err) { - this.logger.error(err); + this.#logger.error(err); } } onopen() { - this.logger.info("Connected", this.events.url); + this.#logger.info("Connected", this.events.url); } onerror(err: ErrorEvent) { - this.logger.error(err); + this.#logger.error(err); } start() { - const events = new EventSource(this.source, { + const events = new EventSource(this.#source, { dispatcher: new EnvHttpProxyAgent(), }); @@ -112,8 +112,8 @@ class Client { events.addEventListener("open", this.onopen.bind(this)); events.addEventListener("error", this.onerror.bind(this)); - this.logger.info(`Forwarding ${this.source} to ${this.target}`); - this.events = events; + this.#logger.info(`Forwarding ${this.#source} to ${this.#target}`); + this.#events = events; return events; } From 6034e6db7ff08f832004693b865c2137c53897e0 Mon Sep 17 00:00:00 2001 From: wolfy1339 <4595477+wolfy1339@users.noreply.github.com> Date: Fri, 23 Aug 2024 13:32:27 -0400 Subject: [PATCH 06/13] fix: correct usage of `this.events` --- index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 831147e..8926509 100644 --- a/index.ts +++ b/index.ts @@ -93,7 +93,7 @@ class Client { } onopen() { - this.#logger.info("Connected", this.events.url); + this.#logger.info("Connected", this.#events.url); } onerror(err: ErrorEvent) { From 684b1e7c2162172e56eebd63f5314e9501436f67 Mon Sep 17 00:00:00 2001 From: wolfy1339 <4595477+wolfy1339@users.noreply.github.com> Date: Fri, 23 Aug 2024 13:34:27 -0400 Subject: [PATCH 07/13] fix usage of this property --- index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 8926509..a9482e7 100644 --- a/index.ts +++ b/index.ts @@ -36,7 +36,7 @@ class Client { this.#logger = logger!; this.#fetch = fetch; - if (!validator.isURL(this.source)) { + if (!validator.isURL(this.#source)) { throw new Error("The provided URL is invalid."); } } From 13aad6257a39b0e27a7bbae3bc14f0313e655962 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Sun, 25 Aug 2024 19:43:31 -0400 Subject: [PATCH 08/13] refactor: initialise EnvHttpProxyAgent only once --- index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.ts b/index.ts index a9482e7..712b1cb 100644 --- a/index.ts +++ b/index.ts @@ -18,10 +18,12 @@ interface Options { fetch?: any; } +const proxyAgent = new EnvHttpProxyAgent() + class Client { #source: string; #target: string; - #fetch: typeof global.fetch; + #fetch: typeof undiciFetch; #logger: Pick; #events!: EventSource; @@ -45,7 +47,7 @@ class Client { const response = await fetch("https://smee.io/new", { method: "HEAD", redirect: "manual", - dispatcher: new EnvHttpProxyAgent(), + dispatcher: proxyAgent, }); const address = response.headers.get("location"); if (!address) { @@ -85,6 +87,7 @@ class Client { mode: data["sec-fetch-mode"], body, headers, + dispatcher: proxyAgent, }); this.#logger.info(`POST ${response.url} - ${response.status}`); } catch (err) { @@ -102,7 +105,7 @@ class Client { start() { const events = new EventSource(this.#source, { - dispatcher: new EnvHttpProxyAgent(), + dispatcher: proxyAgent, }); // Reconnect immediately From 5f0615f3bf82f984920d89ecabf34590ecdcabb1 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Sun, 25 Aug 2024 19:44:42 -0400 Subject: [PATCH 09/13] style: prettier --- index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 712b1cb..e29234a 100644 --- a/index.ts +++ b/index.ts @@ -18,7 +18,7 @@ interface Options { fetch?: any; } -const proxyAgent = new EnvHttpProxyAgent() +const proxyAgent = new EnvHttpProxyAgent(); class Client { #source: string; From eca702e52f33c0c2c43b077dbd1833adf6235663 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Tue, 24 Sep 2024 10:25:58 -0400 Subject: [PATCH 10/13] fix(bin): convert to ESM --- bin/smee.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/smee.js b/bin/smee.js index a704acc..2e9927a 100755 --- a/bin/smee.js +++ b/bin/smee.js @@ -1,9 +1,10 @@ #!/usr/bin/env node -const { program } = require('commander') -const { version } = require('../package.json') +import { program } from 'commander' +import { readFile } from 'node:fs/promises' +import Client from '../index.js' -const Client = require('..') +const { version } = JSON.parse(await readFile(new URL('../package.json', import.meta.url))) program .version(version, '-v, --version') From f525bf522ee34b636f85a8bcc541bab7ac9030c7 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Tue, 24 Sep 2024 10:27:56 -0400 Subject: [PATCH 11/13] style: lint bin script as well --- bin/smee.js | 54 +++++++++++++++++++++++++++++----------------------- package.json | 4 ++-- 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/bin/smee.js b/bin/smee.js index 2e9927a..bda2146 100755 --- a/bin/smee.js +++ b/bin/smee.js @@ -1,35 +1,41 @@ #!/usr/bin/env node -import { program } from 'commander' -import { readFile } from 'node:fs/promises' -import Client from '../index.js' +import { program } from "commander"; +import { readFile } from "node:fs/promises"; +import Client from "../index.js"; -const { version } = JSON.parse(await readFile(new URL('../package.json', import.meta.url))) +const { version } = JSON.parse( + await readFile(new URL("../package.json", import.meta.url)), +); program - .version(version, '-v, --version') - .usage('[options]') - .option('-u, --url ', 'URL of the webhook proxy service. Default: https://smee.io/new') - .option('-t, --target ', 'Full URL (including protocol and path) of the target service the events will forwarded to. Default: http://127.0.0.1:PORT/PATH') - .option('-p, --port ', 'Local HTTP server port', process.env.PORT || 3000) - .option('-P, --path ', 'URL path to post proxied requests to`', '/') - .parse(process.argv) - -const opts = program.opts() - -const { - target = `http://127.0.0.1:${opts.port}${opts.path}` -} = opts - -async function setup () { - let source = opts.url + .version(version, "-v, --version") + .usage("[options]") + .option( + "-u, --url ", + "URL of the webhook proxy service. Default: https://smee.io/new", + ) + .option( + "-t, --target ", + "Full URL (including protocol and path) of the target service the events will forwarded to. Default: http://127.0.0.1:PORT/PATH", + ) + .option("-p, --port ", "Local HTTP server port", process.env.PORT || 3000) + .option("-P, --path ", "URL path to post proxied requests to`", "/") + .parse(process.argv); + +const opts = program.opts(); + +const { target = `http://127.0.0.1:${opts.port}${opts.path}` } = opts; + +async function setup() { + let source = opts.url; if (!source) { - source = await Client.createChannel() + source = await Client.createChannel(); } - const client = new Client({ source, target }) - client.start() + const client = new Client({ source, target }); + client.start(); } -setup() +setup(); diff --git a/package.json b/package.json index c6e1475..9c60844 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,8 @@ ], "scripts": { "build": "tsc -p tsconfig.json", - "lint": "prettier --check \"index.ts\" \"test/**/*.ts\" package.json tsconfig.json --end-of-line auto", - "lint:fix": "prettier --write \"index.ts\" \"test/**/*.ts\" package.json tsconfig.json --end-of-line auto", + "lint": "prettier --check \"index.ts\" \"test/**/*.ts\" bin/smee.js package.json tsconfig.json --end-of-line auto", + "lint:fix": "prettier --write \"index.ts\" \"test/**/*.ts\" bin/smee.js package.json tsconfig.json --end-of-line auto", "test": "vitest run", "test:coverage": "vitest run --coverage", "test:dev": "vitest --ui --coverage" From 233f18535b8961c7dc57813b63ab2584059a1bb8 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Tue, 24 Sep 2024 10:33:33 -0400 Subject: [PATCH 12/13] build: lockfile update --- package-lock.json | 382 ++++++++++++++++++---------------------------- 1 file changed, 145 insertions(+), 237 deletions(-) diff --git a/package-lock.json b/package-lock.json index 74bee43..87e1f4b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -62,13 +62,13 @@ } }, "node_modules/@babel/parser": { - "version": "7.25.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.4.tgz", - "integrity": "sha512-nq+eWrOgdtu3jG5Os4TQP3x3cLA8hR8TvJNjD8vnPa20WGycimcparWnLK4jJhElTK6SDyuJo1weMKO/5LpmLA==", + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.6.tgz", + "integrity": "sha512-trGdfBdbD0l1ZPmcJ83eNxB9rbEax4ALFTF7fN386TMYbeCQbyme5cOEXQhbGXKebwGaB/J52w1mrklMcbgy6Q==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.25.4" + "@babel/types": "^7.25.6" }, "bin": { "parser": "bin/babel-parser.js" @@ -78,9 +78,9 @@ } }, "node_modules/@babel/types": { - "version": "7.25.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.4.tgz", - "integrity": "sha512-zQ1ijeeCXVEh+aNL0RlmkPkG8HUiDcU2pzQQFjtbntgAczRASFzj4H+6+bV+dy1ntKR14I/DypeuRG1uma98iQ==", + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.6.tgz", + "integrity": "sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==", "dev": true, "license": "MIT", "dependencies": { @@ -853,16 +853,16 @@ ] }, "node_modules/@types/estree": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", - "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", "dev": true, "license": "MIT" }, "node_modules/@types/node": { - "version": "18.19.45", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.45.tgz", - "integrity": "sha512-VZxPKNNhjKmaC1SUYowuXSRSMGyQGmQjvvA1xE4QZ0xce2kLtEhPDS+kqpCPBZYgqblCLQ2DAjSzmgCM5auvhA==", + "version": "18.19.50", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.50.tgz", + "integrity": "sha512-xonK+NRrMBRtkL1hVCc3G+uXtjh1Al4opBLjqVmipe5ZAaBYWW6cNAiBVZ1BvmkBhep698rP3UM3aRAdSALuhg==", "dev": true, "license": "MIT", "dependencies": { @@ -870,27 +870,27 @@ } }, "node_modules/@types/validator": { - "version": "13.12.0", - "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.12.0.tgz", - "integrity": "sha512-nH45Lk7oPIJ1RVOF6JgFI6Dy0QpHEzq4QecZhvguxYPDwT8c93prCMqAtiIttm39voZ+DDR+qkNnMpJmMBRqag==", + "version": "13.12.2", + "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.12.2.tgz", + "integrity": "sha512-6SlHBzUW8Jhf3liqrGGXyTJSIFe4nqlJ5A5KaMZ2l/vbM3Wh3KSybots/wfWVzNLK4D1NZluDlSQIbIEPx6oyA==", "dev": true, "license": "MIT" }, "node_modules/@vitest/coverage-v8": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-2.0.5.tgz", - "integrity": "sha512-qeFcySCg5FLO2bHHSa0tAZAOnAUbp4L6/A5JDuj9+bt53JREl8hpLjLHEWF0e/gWc8INVpJaqA7+Ene2rclpZg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-2.1.1.tgz", + "integrity": "sha512-md/A7A3c42oTT8JUHSqjP5uKTWJejzUW4jalpvs+rZ27gsURsMU8DEb+8Jf8C6Kj2gwfSHJqobDNBuoqlm0cFw==", "dev": true, "license": "MIT", "dependencies": { "@ampproject/remapping": "^2.3.0", "@bcoe/v8-coverage": "^0.2.3", - "debug": "^4.3.5", + "debug": "^4.3.6", "istanbul-lib-coverage": "^3.2.2", "istanbul-lib-report": "^3.0.1", "istanbul-lib-source-maps": "^5.0.6", "istanbul-reports": "^3.1.7", - "magic-string": "^0.30.10", + "magic-string": "^0.30.11", "magicast": "^0.3.4", "std-env": "^3.7.0", "test-exclude": "^7.0.1", @@ -900,18 +900,24 @@ "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "vitest": "2.0.5" + "@vitest/browser": "2.1.1", + "vitest": "2.1.1" + }, + "peerDependenciesMeta": { + "@vitest/browser": { + "optional": true + } } }, "node_modules/@vitest/expect": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.0.5.tgz", - "integrity": "sha512-yHZtwuP7JZivj65Gxoi8upUN2OzHTi3zVfjwdpu2WrvCZPLwsJ2Ey5ILIPccoW23dd/zQBlJ4/dhi7DWNyXCpA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.1.tgz", + "integrity": "sha512-YeueunS0HiHiQxk+KEOnq/QMzlUuOzbU1Go+PgAsHvvv3tUkJPm9xWt+6ITNTlzsMXUjmgm5T+U7KBPK2qQV6w==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "2.0.5", - "@vitest/utils": "2.0.5", + "@vitest/spy": "2.1.1", + "@vitest/utils": "2.1.1", "chai": "^5.1.1", "tinyrainbow": "^1.2.0" }, @@ -919,10 +925,38 @@ "url": "https://opencollective.com/vitest" } }, + "node_modules/@vitest/mocker": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.1.tgz", + "integrity": "sha512-LNN5VwOEdJqCmJ/2XJBywB11DLlkbY0ooDJW3uRX5cZyYCrc4PI/ePX0iQhE3BiEGiQmK4GE7Q/PqCkkaiPnrA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "^2.1.0-beta.1", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.11" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@vitest/spy": "2.1.1", + "msw": "^2.3.5", + "vite": "^5.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, "node_modules/@vitest/pretty-format": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.0.5.tgz", - "integrity": "sha512-h8k+1oWHfwTkyTkb9egzwNMfJAEx4veaPSnMeKbVSjp4euqGSbQlm5+6VHwTr7u4FJslVVsUG5nopCaAYdOmSQ==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.1.tgz", + "integrity": "sha512-SjxPFOtuINDUW8/UkElJYQSFtnWX7tMksSGW0vfjxMneFqxVr8YJ979QpMbDW7g+BIiq88RAGDjf7en6rvLPPQ==", "dev": true, "license": "MIT", "dependencies": { @@ -933,13 +967,13 @@ } }, "node_modules/@vitest/runner": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.0.5.tgz", - "integrity": "sha512-TfRfZa6Bkk9ky4tW0z20WKXFEwwvWhRY+84CnSEtq4+3ZvDlJyY32oNTJtM7AW9ihW90tX/1Q78cb6FjoAs+ig==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.1.tgz", + "integrity": "sha512-uTPuY6PWOYitIkLPidaY5L3t0JJITdGTSwBtwMjKzo5O6RCOEncz9PUN+0pDidX8kTHYjO0EwUIvhlGpnGpxmA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "2.0.5", + "@vitest/utils": "2.1.1", "pathe": "^1.1.2" }, "funding": { @@ -947,14 +981,14 @@ } }, "node_modules/@vitest/snapshot": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.0.5.tgz", - "integrity": "sha512-SgCPUeDFLaM0mIUHfaArq8fD2WbaXG/zVXjRupthYfYGzc8ztbFbu6dUNOblBG7XLMR1kEhS/DNnfCZ2IhdDew==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.1.tgz", + "integrity": "sha512-BnSku1WFy7r4mm96ha2FzN99AZJgpZOWrAhtQfoxjUU5YMRpq1zmHRq7a5K9/NjqonebO7iVDla+VvZS8BOWMw==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "2.0.5", - "magic-string": "^0.30.10", + "@vitest/pretty-format": "2.1.1", + "magic-string": "^0.30.11", "pathe": "^1.1.2" }, "funding": { @@ -962,9 +996,9 @@ } }, "node_modules/@vitest/spy": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.0.5.tgz", - "integrity": "sha512-c/jdthAhvJdpfVuaexSrnawxZz6pywlTPe84LUB2m/4t3rl2fTo9NFGBG4oWgaD+FTgDDV8hJ/nibT7IfH3JfA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.1.tgz", + "integrity": "sha512-ZM39BnZ9t/xZ/nF4UwRH5il0Sw93QnZXd9NAZGRpIgj0yvVwPpLd702s/Cx955rGaMlyBQkZJ2Ir7qyY48VZ+g==", "dev": true, "license": "MIT", "dependencies": { @@ -975,14 +1009,13 @@ } }, "node_modules/@vitest/utils": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.0.5.tgz", - "integrity": "sha512-d8HKbqIcya+GR67mkZbrzhS5kKhtp8dQLcmRZLGTscGVg7yImT82cIrhtn2L8+VujWcy6KZweApgNmPsTAO/UQ==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.1.tgz", + "integrity": "sha512-Y6Q9TsI+qJ2CC0ZKj6VBb+T8UPz593N113nnUykqwANqhgf3QkZeHFlusgKLTqrnVHbj/XDKZcDHol+dxVT+rQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "2.0.5", - "estree-walker": "^3.0.3", + "@vitest/pretty-format": "2.1.1", "loupe": "^3.1.1", "tinyrainbow": "^1.2.0" }, @@ -1053,9 +1086,9 @@ "license": "MIT" }, "node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "dev": true, "license": "MIT", "engines": { @@ -1264,13 +1297,13 @@ } }, "node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dev": true, "license": "MIT", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -1374,30 +1407,6 @@ "node": ">=0.8.x" } }, - "node_modules/execa": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", - "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", - "dev": true, - "license": "MIT", - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^8.0.1", - "human-signals": "^5.0.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^4.1.0", - "strip-final-newline": "^3.0.0" - }, - "engines": { - "node": ">=16.17" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, "node_modules/fast-content-type-parse": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fast-content-type-parse/-/fast-content-type-parse-1.1.0.tgz", @@ -1592,19 +1601,6 @@ "node": "*" } }, - "node_modules/get-stream": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", - "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/glob": { "version": "10.4.5", "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", @@ -1643,16 +1639,6 @@ "dev": true, "license": "MIT" }, - "node_modules/human-signals": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", - "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=16.17.0" - } - }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -1694,19 +1680,6 @@ "node": ">=8" } }, - "node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -1841,14 +1814,14 @@ } }, "node_modules/magicast": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.4.tgz", - "integrity": "sha512-TyDF/Pn36bBji9rWKHlZe+PZb6Mx5V8IHCSxk7X4aljM4e/vyDvZZYwHewdVaqiA0nb3ghfHU/6AUpDxWoER2Q==", + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.5.tgz", + "integrity": "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/parser": "^7.24.4", - "@babel/types": "^7.24.0", + "@babel/parser": "^7.25.4", + "@babel/types": "^7.25.4", "source-map-js": "^1.2.0" } }, @@ -1868,26 +1841,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true, - "license": "MIT" - }, - "node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/minimatch": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", @@ -1915,9 +1868,9 @@ } }, "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true, "license": "MIT" }, @@ -1940,35 +1893,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/npm-run-path": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", - "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/npm-run-path/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/on-exit-leak-free": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz", @@ -1979,22 +1903,6 @@ "node": ">=14.0.0" } }, - "node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/package-json-from-dist": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", @@ -2054,9 +1962,9 @@ "license": "ISC" }, "node_modules/pino": { - "version": "9.3.2", - "resolved": "https://registry.npmjs.org/pino/-/pino-9.3.2.tgz", - "integrity": "sha512-WtARBjgZ7LNEkrGWxMBN/jvlFiE17LTbBoH0konmBU684Kd0uIiDwBXlcTCW7iJnA6HfIKwUssS/2AC6cDEanw==", + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/pino/-/pino-9.4.0.tgz", + "integrity": "sha512-nbkQb5+9YPhQRz/BeQmrWpEknAaqjpAqRK8NwJpmrX/JHu7JuZC5G1CeAwJDJfGes4h+YihC6in3Q2nGb+Y09w==", "dev": true, "license": "MIT", "dependencies": { @@ -2285,6 +2193,13 @@ "fsevents": "~2.3.2" } }, + "node_modules/rollup/node_modules/@types/estree": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "dev": true, + "license": "MIT" + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -2317,9 +2232,9 @@ } }, "node_modules/safe-stable-stringify": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", - "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", + "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", "dev": true, "license": "MIT", "engines": { @@ -2397,9 +2312,9 @@ } }, "node_modules/sonic-boom": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.0.1.tgz", - "integrity": "sha512-hTSD/6JMLyT4r9zeof6UtuBDpjJ9sO08/nmS5djaA9eozT9oOlNdpXSnzcgj4FTqpk3nkLrs61l4gip9r1HCrQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.1.0.tgz", + "integrity": "sha512-NGipjjRicyJJ03rPiZCJYjwlsuP2d1/5QUviozRXC7S3WdVWNK5e3Ojieb9CCyfhq2UC+3+SRd9nG3I2lPRvUw==", "dev": true, "license": "MIT", "dependencies": { @@ -2554,19 +2469,6 @@ "node": ">=8" } }, - "node_modules/strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -2612,6 +2514,13 @@ "dev": true, "license": "MIT" }, + "node_modules/tinyexec": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.0.tgz", + "integrity": "sha512-tVGE0mVJPGb0chKhqmsoosjsS+qUnJVGJpZgsHYQcGoPlG3B51R3PouqTgEGH2Dc9jjFyOqOpix6ZHNMXp1FZg==", + "dev": true, + "license": "MIT" + }, "node_modules/tinypool": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.0.1.tgz", @@ -2633,9 +2542,9 @@ } }, "node_modules/tinyspy": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-3.0.0.tgz", - "integrity": "sha512-q5nmENpTHgiPVd1cJDDc9cVoYN5x4vCvwT3FMilvKPKneCBZAxn2YWQjDF0UMcE9k0Cay1gBiDfTMU0g+mPMQA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-3.0.2.tgz", + "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==", "dev": true, "license": "MIT", "engines": { @@ -2663,9 +2572,9 @@ } }, "node_modules/typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", + "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -2762,16 +2671,15 @@ } }, "node_modules/vite-node": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.0.5.tgz", - "integrity": "sha512-LdsW4pxj0Ot69FAoXZ1yTnA9bjGohr2yNBU7QKRxpz8ITSkhuDl6h3zS/tvgz4qrNjeRnvrWeXQ8ZF7Um4W00Q==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.1.tgz", + "integrity": "sha512-N/mGckI1suG/5wQI35XeR9rsMsPqKXzq1CdUndzVstBj/HvyxxGctwnK6WX43NGt5L3Z5tcRf83g4TITKJhPrA==", "dev": true, "license": "MIT", "dependencies": { "cac": "^6.7.14", - "debug": "^4.3.5", + "debug": "^4.3.6", "pathe": "^1.1.2", - "tinyrainbow": "^1.2.0", "vite": "^5.0.0" }, "bin": { @@ -2785,30 +2693,30 @@ } }, "node_modules/vitest": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.0.5.tgz", - "integrity": "sha512-8GUxONfauuIdeSl5f9GTgVEpg5BTOlplET4WEDaeY2QBiN8wSm68vxN/tb5z405OwppfoCavnwXafiaYBC/xOA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.1.tgz", + "integrity": "sha512-97We7/VC0e9X5zBVkvt7SGQMGrRtn3KtySFQG5fpaMlS+l62eeXRQO633AYhSTC3z7IMebnPPNjGXVGNRFlxBA==", "dev": true, "license": "MIT", "dependencies": { - "@ampproject/remapping": "^2.3.0", - "@vitest/expect": "2.0.5", - "@vitest/pretty-format": "^2.0.5", - "@vitest/runner": "2.0.5", - "@vitest/snapshot": "2.0.5", - "@vitest/spy": "2.0.5", - "@vitest/utils": "2.0.5", + "@vitest/expect": "2.1.1", + "@vitest/mocker": "2.1.1", + "@vitest/pretty-format": "^2.1.1", + "@vitest/runner": "2.1.1", + "@vitest/snapshot": "2.1.1", + "@vitest/spy": "2.1.1", + "@vitest/utils": "2.1.1", "chai": "^5.1.1", - "debug": "^4.3.5", - "execa": "^8.0.1", - "magic-string": "^0.30.10", + "debug": "^4.3.6", + "magic-string": "^0.30.11", "pathe": "^1.1.2", "std-env": "^3.7.0", - "tinybench": "^2.8.0", + "tinybench": "^2.9.0", + "tinyexec": "^0.3.0", "tinypool": "^1.0.0", "tinyrainbow": "^1.2.0", "vite": "^5.0.0", - "vite-node": "2.0.5", + "vite-node": "2.1.1", "why-is-node-running": "^2.3.0" }, "bin": { @@ -2823,8 +2731,8 @@ "peerDependencies": { "@edge-runtime/vm": "*", "@types/node": "^18.0.0 || >=20.0.0", - "@vitest/browser": "2.0.5", - "@vitest/ui": "2.0.5", + "@vitest/browser": "2.1.1", + "@vitest/ui": "2.1.1", "happy-dom": "*", "jsdom": "*" }, From 6dad1c915cb284e9dd8471c4ee409fbb1d63d106 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Tue, 24 Sep 2024 10:33:57 -0400 Subject: [PATCH 13/13] refactor: use `node:` imports --- index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.ts b/index.ts index e29234a..4f40600 100644 --- a/index.ts +++ b/index.ts @@ -6,8 +6,8 @@ import { type ErrorEvent, type MessageEvent, } from "undici"; -import url from "url"; -import querystring from "querystring"; +import url from "node:url"; +import querystring from "node:querystring"; type Severity = "info" | "error";