From 545d52b8d9493687468f187e1e1976eff41c359a Mon Sep 17 00:00:00 2001 From: Jon Friesen Date: Fri, 5 Jan 2024 12:21:20 -0700 Subject: [PATCH] migrates from router to endpoint (#2) --- README.md | 4 ++-- examples/deno/import_map.json | 4 ++-- examples/simple/package-lock.json | 26 +++++++++++++++++++++----- examples/simple/package.json | 2 +- examples/simple/src/index.ts | 4 ++-- package-lock.json | 22 +++++++++++----------- package.json | 4 ++-- src/index.ts | 4 ++-- src/url-rewriter.ts | 4 ++-- 9 files changed, 45 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 9d7f3b0..de03365 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,12 @@ The proxy needs to mask the url to match the outer domain URL: https://qpoint.io ## Usage ```ts -import Router from "@qpoint/router"; +import Endpoint from "@qpoint/endpoint"; import proxy from "@qpoint/proxy"; import maskUrls from "@qpoint/mask-urls"; import rewriteHtml from "@qpoint/rewrite-html"; -export default new Router() +export default new Endpoint() // proxy to qpoint.io .use(proxy({ appUrl: "https://qpoint.io" })) diff --git a/examples/deno/import_map.json b/examples/deno/import_map.json index a933b02..94fdc94 100644 --- a/examples/deno/import_map.json +++ b/examples/deno/import_map.json @@ -1,8 +1,8 @@ { "imports": { - "@qpoint/router": "https://esm.sh/@qpoint/router@0.1.6?bundle", + "@qpoint/endpoint": "https://esm.sh/@qpoint/endpoint@0.0.1?bundle", "@qpoint/proxy": "https://esm.sh/@qpoint/proxy@0.1.0?bundle", "@qpoint/mask-urls": "https://esm.sh/@qpoint/mask-urls@0.1.0?bundle", "@qpoint/rewrite-html": "https://esm.sh/@qpoint/rewrite-html@0.1.0?bundle" } -} \ No newline at end of file +} diff --git a/examples/simple/package-lock.json b/examples/simple/package-lock.json index ad91eb5..1e3086f 100644 --- a/examples/simple/package-lock.json +++ b/examples/simple/package-lock.json @@ -7,11 +7,11 @@ "": { "version": "0.0.0", "dependencies": { + "@qpoint/endpoint": "^0.0.1", "@qpoint/mask-urls": "file:../..", "@qpoint/proxy": "^0.1.0", "@qpoint/replace-content": "^0.1.0", - "@qpoint/rewrite-html": "^0.1.0", - "@qpoint/router": "^0.1.12" + "@qpoint/rewrite-html": "^0.1.0" }, "devDependencies": { "@cloudflare/workers-types": "^3.0.0", @@ -32,10 +32,10 @@ }, "../..": { "name": "@qpoint/mask-urls", - "version": "0.1.0", + "version": "0.0.0", "license": "Apache-2.0", "dependencies": { - "@qpoint/router": "^0.1.12" + "@qpoint/endpoint": "^0.0.1" }, "devDependencies": { "@cloudflare/workers-types": "^3.5.1", @@ -1488,6 +1488,14 @@ "node": ">= 8" } }, + "node_modules/@qpoint/endpoint": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@qpoint/endpoint/-/endpoint-0.0.1.tgz", + "integrity": "sha512-JMBqvVeFwNt1o/pzw5Lgy37KQSiFDP5aAkpAd9+zmA2T8G/RNQ5X8bANq0TibojfqUXjgg1HtBLhTrDvktvjoQ==", + "dependencies": { + "koa-compose": "^4.1.0" + } + }, "node_modules/@qpoint/mask-urls": { "resolved": "../..", "link": true @@ -7194,11 +7202,19 @@ "fastq": "^1.6.0" } }, + "@qpoint/endpoint": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@qpoint/endpoint/-/endpoint-0.0.1.tgz", + "integrity": "sha512-JMBqvVeFwNt1o/pzw5Lgy37KQSiFDP5aAkpAd9+zmA2T8G/RNQ5X8bANq0TibojfqUXjgg1HtBLhTrDvktvjoQ==", + "requires": { + "koa-compose": "^4.1.0" + } + }, "@qpoint/mask-urls": { "version": "file:../..", "requires": { "@cloudflare/workers-types": "^3.5.1", - "@qpoint/router": "^0.1.12", + "@qpoint/endpoint": "^0.0.1", "@types/node": "^17.0.25", "typescript": "^4.6.3" } diff --git a/examples/simple/package.json b/examples/simple/package.json index d3e81eb..2a6dbc1 100644 --- a/examples/simple/package.json +++ b/examples/simple/package.json @@ -25,6 +25,6 @@ "@qpoint/proxy": "^0.1.0", "@qpoint/replace-content": "^0.1.0", "@qpoint/rewrite-html": "^0.1.0", - "@qpoint/router": "^0.1.12" + "@qpoint/endpoint": "^0.0.1" } } diff --git a/examples/simple/src/index.ts b/examples/simple/src/index.ts index d6a8005..8854a3d 100644 --- a/examples/simple/src/index.ts +++ b/examples/simple/src/index.ts @@ -1,9 +1,9 @@ -import Router from "@qpoint/router"; +import Endpoint from "@qpoint/endpoint"; import proxy from "@qpoint/proxy"; import maskUrls from "@qpoint/mask-urls"; import rewriteHtml from "@qpoint/rewrite-html"; -export default new Router() +export default new Endpoint() // proxy to qpoint.io // .use(proxy({ appUrl: "https://qpoint.io" })) diff --git a/package-lock.json b/package-lock.json index df41ef1..e1495b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "@qpoint/mask-urls", - "version": "0.2.0", + "version": "0.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@qpoint/mask-urls", - "version": "0.2.0", + "version": "0.0.0", "license": "Apache-2.0", "dependencies": { - "@qpoint/router": "^0.2.0" + "@qpoint/endpoint": "^0.0.1" }, "devDependencies": { "@cloudflare/workers-types": "^3.5.1", @@ -23,10 +23,10 @@ "integrity": "sha512-gaBUSaKS65mN3iKZEgichbXYEmAa/pXkc5Gbt+1BptYphdGkj09ggdsiE4w8g0F/uI1g36QaTKrzVnBAWMipvQ==", "dev": true }, - "node_modules/@qpoint/router": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@qpoint/router/-/router-0.2.0.tgz", - "integrity": "sha512-1uKTeTTHTcJ/QI/dYF1z0WvMpU9McWEl+b1hLhy3BcFsbEDQIoE1Yzpol8kC98t8N5+gdzWRZVzLUPCbDjPR2g==", + "node_modules/@qpoint/endpoint": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@qpoint/endpoint/-/endpoint-0.0.1.tgz", + "integrity": "sha512-JMBqvVeFwNt1o/pzw5Lgy37KQSiFDP5aAkpAd9+zmA2T8G/RNQ5X8bANq0TibojfqUXjgg1HtBLhTrDvktvjoQ==", "dependencies": { "koa-compose": "^4.1.0" } @@ -63,10 +63,10 @@ "integrity": "sha512-gaBUSaKS65mN3iKZEgichbXYEmAa/pXkc5Gbt+1BptYphdGkj09ggdsiE4w8g0F/uI1g36QaTKrzVnBAWMipvQ==", "dev": true }, - "@qpoint/router": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@qpoint/router/-/router-0.2.0.tgz", - "integrity": "sha512-1uKTeTTHTcJ/QI/dYF1z0WvMpU9McWEl+b1hLhy3BcFsbEDQIoE1Yzpol8kC98t8N5+gdzWRZVzLUPCbDjPR2g==", + "@qpoint/endpoint": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@qpoint/endpoint/-/endpoint-0.0.1.tgz", + "integrity": "sha512-JMBqvVeFwNt1o/pzw5Lgy37KQSiFDP5aAkpAd9+zmA2T8G/RNQ5X8bANq0TibojfqUXjgg1HtBLhTrDvktvjoQ==", "requires": { "koa-compose": "^4.1.0" } diff --git a/package.json b/package.json index 98c88d6..3c2832c 100644 --- a/package.json +++ b/package.json @@ -16,10 +16,10 @@ "scripts": { "build": "tsc", "release": "npm publish --access=public", - "bundle": "esbuild src/index.ts --outdir=dist --bundle --sourcemap=external --platform=browser --format=esm" + "bundle": "npx esbuild src/index.ts --outdir=dist --bundle --sourcemap=external --platform=browser --format=esm" }, "dependencies": { - "@qpoint/router": "^0.2.0" + "@qpoint/endpoint": "^0.0.1" }, "devDependencies": { "@cloudflare/workers-types": "^3.5.1", diff --git a/src/index.ts b/src/index.ts index 8277035..bfd3149 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { Context } from '@qpoint/router' +import { Context } from '@qpoint/endpoint' import { UrlRewriter } from './url-rewriter' export interface MaskUrlsConfig { @@ -54,4 +54,4 @@ export default function rewriteHtml(config: MaskUrlsConfig = {}) { // continue along return next(); } -} \ No newline at end of file +} diff --git a/src/url-rewriter.ts b/src/url-rewriter.ts index 0f8f5c1..5a32754 100644 --- a/src/url-rewriter.ts +++ b/src/url-rewriter.ts @@ -1,4 +1,4 @@ -import { Context } from '@qpoint/router' +import { Context } from '@qpoint/endpoint' import { MaskUrlsConfig } from '.' interface LinkPattern { @@ -66,4 +66,4 @@ export class UrlRewriter { } } } -} \ No newline at end of file +}