From aa4b2b37c862fdf8b9b32f490a7a8b9f07017378 Mon Sep 17 00:00:00 2001 From: Max Isom Date: Thu, 11 Jan 2024 12:19:24 -0800 Subject: [PATCH] Elimiate side effects in example for tree shaking --- apps/example-todo-app/lib/middlewares/with-route-spec.ts | 1 - .../pages/api/todo/add-ignore-invalid-json-response.ts | 6 ++---- .../pages/api/todo/add-with-global-middeware-after-auth.ts | 6 ++---- apps/example-todo-app/pages/api/todo/add.ts | 3 ++- .../example-todo-app/pages/api/todo/array-query-brackets.ts | 6 ++---- apps/example-todo-app/pages/api/todo/array-query-comma.ts | 6 ++---- apps/example-todo-app/pages/api/todo/array-query-default.ts | 3 ++- apps/example-todo-app/pages/api/todo/array-query-repeat.ts | 6 ++---- .../example-todo-app/pages/api/todo/delete-common-params.ts | 3 ++- apps/example-todo-app/pages/api/todo/delete.ts | 3 ++- .../example-todo-app/pages/api/todo/exclude-from-openapi.ts | 3 ++- apps/example-todo-app/pages/api/todo/form-add.ts | 3 ++- apps/example-todo-app/pages/api/todo/get.ts | 3 ++- apps/example-todo-app/pages/api/todo/index.ts | 3 ++- apps/example-todo-app/pages/api/todo/list-optional-ids.ts | 3 ++- apps/example-todo-app/pages/api/todo/list-with-refine.ts | 3 ++- apps/example-todo-app/pages/api/todo/list.ts | 3 ++- apps/example-todo-app/pages/api/todo/no-validate-body.ts | 6 ++---- 18 files changed, 34 insertions(+), 36 deletions(-) diff --git a/apps/example-todo-app/lib/middlewares/with-route-spec.ts b/apps/example-todo-app/lib/middlewares/with-route-spec.ts index 6e15c52b4..16bea6cef 100644 --- a/apps/example-todo-app/lib/middlewares/with-route-spec.ts +++ b/apps/example-todo-app/lib/middlewares/with-route-spec.ts @@ -5,7 +5,6 @@ import { } from "nextlove" import { withAuthToken } from "./with-auth-token" import { withUserSession } from "./with-user-session" -export { checkRouteSpec } from "nextlove" import * as ZT from "lib/zod" import withGlobalMiddlewareAfterAuth from "./with-global-middeware-after-auth" diff --git a/apps/example-todo-app/pages/api/todo/add-ignore-invalid-json-response.ts b/apps/example-todo-app/pages/api/todo/add-ignore-invalid-json-response.ts index 3735c79c2..b88fb0826 100644 --- a/apps/example-todo-app/pages/api/todo/add-ignore-invalid-json-response.ts +++ b/apps/example-todo-app/pages/api/todo/add-ignore-invalid-json-response.ts @@ -1,7 +1,5 @@ -import { - withRouteSpecWithoutValidateResponse, - checkRouteSpec, -} from "lib/middlewares" +import { withRouteSpecWithoutValidateResponse } from "lib/middlewares" +import { checkRouteSpec } from "nextlove" import { z } from "zod" import { v4 as uuidv4 } from "uuid" diff --git a/apps/example-todo-app/pages/api/todo/add-with-global-middeware-after-auth.ts b/apps/example-todo-app/pages/api/todo/add-with-global-middeware-after-auth.ts index 7d1348176..1b98b4ac1 100644 --- a/apps/example-todo-app/pages/api/todo/add-with-global-middeware-after-auth.ts +++ b/apps/example-todo-app/pages/api/todo/add-with-global-middeware-after-auth.ts @@ -1,7 +1,5 @@ -import { - checkRouteSpec, - withRouteSpecWithGlobalMiddlewareAfterAuth, -} from "lib/middlewares" +import { withRouteSpecWithGlobalMiddlewareAfterAuth } from "lib/middlewares" +import { checkRouteSpec } from "nextlove" import { z } from "zod" import { v4 as uuidv4 } from "uuid" diff --git a/apps/example-todo-app/pages/api/todo/add.ts b/apps/example-todo-app/pages/api/todo/add.ts index 159a1e4c1..4a12ecd7f 100644 --- a/apps/example-todo-app/pages/api/todo/add.ts +++ b/apps/example-todo-app/pages/api/todo/add.ts @@ -1,4 +1,5 @@ -import { withRouteSpec, checkRouteSpec } from "lib/middlewares" +import { withRouteSpec } from "lib/middlewares" +import { checkRouteSpec } from "nextlove" import { z } from "zod" import { v4 as uuidv4 } from "uuid" diff --git a/apps/example-todo-app/pages/api/todo/array-query-brackets.ts b/apps/example-todo-app/pages/api/todo/array-query-brackets.ts index 2ea6ac1e0..a4b8ee8b3 100644 --- a/apps/example-todo-app/pages/api/todo/array-query-brackets.ts +++ b/apps/example-todo-app/pages/api/todo/array-query-brackets.ts @@ -1,7 +1,5 @@ -import { - withRouteSpecSupportedArrayFormats, - checkRouteSpec, -} from "lib/middlewares" +import { withRouteSpecSupportedArrayFormats } from "lib/middlewares" +import { checkRouteSpec } from "nextlove" import { z } from "zod" export const queryParams = z.object({ diff --git a/apps/example-todo-app/pages/api/todo/array-query-comma.ts b/apps/example-todo-app/pages/api/todo/array-query-comma.ts index b3ee64561..2cc5fa547 100644 --- a/apps/example-todo-app/pages/api/todo/array-query-comma.ts +++ b/apps/example-todo-app/pages/api/todo/array-query-comma.ts @@ -1,7 +1,5 @@ -import { - withRouteSpecSupportedArrayFormats, - checkRouteSpec, -} from "lib/middlewares" +import { withRouteSpecSupportedArrayFormats } from "lib/middlewares" +import { checkRouteSpec } from "nextlove" import { z } from "zod" export const queryParams = z.object({ diff --git a/apps/example-todo-app/pages/api/todo/array-query-default.ts b/apps/example-todo-app/pages/api/todo/array-query-default.ts index 23e1fcc99..e6b0d22cf 100644 --- a/apps/example-todo-app/pages/api/todo/array-query-default.ts +++ b/apps/example-todo-app/pages/api/todo/array-query-default.ts @@ -1,4 +1,5 @@ -import { checkRouteSpec, withRouteSpec } from "lib/middlewares" +import { withRouteSpec } from "lib/middlewares" +import { checkRouteSpec } from "nextlove" import { z } from "zod" export const queryParams = z.object({ diff --git a/apps/example-todo-app/pages/api/todo/array-query-repeat.ts b/apps/example-todo-app/pages/api/todo/array-query-repeat.ts index 1d7813f77..d59b4db01 100644 --- a/apps/example-todo-app/pages/api/todo/array-query-repeat.ts +++ b/apps/example-todo-app/pages/api/todo/array-query-repeat.ts @@ -1,7 +1,5 @@ -import { - withRouteSpecSupportedArrayFormats, - checkRouteSpec, -} from "lib/middlewares" +import { checkRouteSpec } from "nextlove" +import { withRouteSpecSupportedArrayFormats } from "lib/middlewares" import { z } from "zod" export const queryParams = z.object({ diff --git a/apps/example-todo-app/pages/api/todo/delete-common-params.ts b/apps/example-todo-app/pages/api/todo/delete-common-params.ts index 5ca5fe286..8d100daaf 100644 --- a/apps/example-todo-app/pages/api/todo/delete-common-params.ts +++ b/apps/example-todo-app/pages/api/todo/delete-common-params.ts @@ -1,4 +1,5 @@ -import { checkRouteSpec, withRouteSpec } from "lib/middlewares" +import { checkRouteSpec } from "nextlove" +import { withRouteSpec } from "lib/middlewares" import { NotFoundException } from "nextlove" import { TODO_ID } from "tests/fixtures" import { z } from "zod" diff --git a/apps/example-todo-app/pages/api/todo/delete.ts b/apps/example-todo-app/pages/api/todo/delete.ts index 85ee01b81..6e3dcc1e3 100644 --- a/apps/example-todo-app/pages/api/todo/delete.ts +++ b/apps/example-todo-app/pages/api/todo/delete.ts @@ -1,4 +1,5 @@ -import { checkRouteSpec, withRouteSpec } from "lib/middlewares" +import { checkRouteSpec } from "nextlove" +import { withRouteSpec } from "lib/middlewares" import { NotFoundException } from "nextlove" import { TODO_ID } from "tests/fixtures" import { z } from "zod" diff --git a/apps/example-todo-app/pages/api/todo/exclude-from-openapi.ts b/apps/example-todo-app/pages/api/todo/exclude-from-openapi.ts index 80be19951..0f0bedf67 100644 --- a/apps/example-todo-app/pages/api/todo/exclude-from-openapi.ts +++ b/apps/example-todo-app/pages/api/todo/exclude-from-openapi.ts @@ -1,4 +1,5 @@ -import { withRouteSpec, checkRouteSpec } from "lib/middlewares" +import { checkRouteSpec } from "nextlove" +import { withRouteSpec } from "lib/middlewares" import { z } from "zod" export const jsonBody = z.object({}) diff --git a/apps/example-todo-app/pages/api/todo/form-add.ts b/apps/example-todo-app/pages/api/todo/form-add.ts index 86f70bede..2b351a0d7 100644 --- a/apps/example-todo-app/pages/api/todo/form-add.ts +++ b/apps/example-todo-app/pages/api/todo/form-add.ts @@ -1,4 +1,5 @@ -import { withRouteSpec, checkRouteSpec } from "lib/middlewares" +import { checkRouteSpec } from "nextlove" +import { withRouteSpec } from "lib/middlewares" import { z } from "zod" import { v4 as uuidv4 } from "uuid" import { HttpException } from "nextlove" diff --git a/apps/example-todo-app/pages/api/todo/get.ts b/apps/example-todo-app/pages/api/todo/get.ts index 767e05c8d..491109155 100644 --- a/apps/example-todo-app/pages/api/todo/get.ts +++ b/apps/example-todo-app/pages/api/todo/get.ts @@ -1,4 +1,5 @@ -import { checkRouteSpec, withRouteSpec } from "lib/middlewares" +import { checkRouteSpec } from "nextlove" +import { withRouteSpec } from "lib/middlewares" import { NotFoundException } from "nextlove" import { TODO_ID } from "tests/fixtures" import { z } from "zod" diff --git a/apps/example-todo-app/pages/api/todo/index.ts b/apps/example-todo-app/pages/api/todo/index.ts index 767e05c8d..491109155 100644 --- a/apps/example-todo-app/pages/api/todo/index.ts +++ b/apps/example-todo-app/pages/api/todo/index.ts @@ -1,4 +1,5 @@ -import { checkRouteSpec, withRouteSpec } from "lib/middlewares" +import { checkRouteSpec } from "nextlove" +import { withRouteSpec } from "lib/middlewares" import { NotFoundException } from "nextlove" import { TODO_ID } from "tests/fixtures" import { z } from "zod" diff --git a/apps/example-todo-app/pages/api/todo/list-optional-ids.ts b/apps/example-todo-app/pages/api/todo/list-optional-ids.ts index 8066ff350..c12089482 100644 --- a/apps/example-todo-app/pages/api/todo/list-optional-ids.ts +++ b/apps/example-todo-app/pages/api/todo/list-optional-ids.ts @@ -1,4 +1,5 @@ -import { checkRouteSpec, withRouteSpec } from "lib/middlewares" +import { checkRouteSpec } from "nextlove" +import { withRouteSpec } from "lib/middlewares" import { z } from "zod" import * as ZT from "lib/zod" diff --git a/apps/example-todo-app/pages/api/todo/list-with-refine.ts b/apps/example-todo-app/pages/api/todo/list-with-refine.ts index aee8d17ce..5dbdeb39e 100644 --- a/apps/example-todo-app/pages/api/todo/list-with-refine.ts +++ b/apps/example-todo-app/pages/api/todo/list-with-refine.ts @@ -1,4 +1,5 @@ -import { checkRouteSpec, withRouteSpec } from "lib/middlewares" +import { checkRouteSpec } from "nextlove" +import { withRouteSpec } from "lib/middlewares" import { z } from "zod" import * as ZT from "lib/zod" diff --git a/apps/example-todo-app/pages/api/todo/list.ts b/apps/example-todo-app/pages/api/todo/list.ts index 89beaa1cc..9401e5f51 100644 --- a/apps/example-todo-app/pages/api/todo/list.ts +++ b/apps/example-todo-app/pages/api/todo/list.ts @@ -1,4 +1,5 @@ -import { checkRouteSpec, withRouteSpec } from "lib/middlewares" +import { checkRouteSpec } from "nextlove" +import { withRouteSpec } from "lib/middlewares" import { z } from "zod" import * as ZT from "lib/zod" diff --git a/apps/example-todo-app/pages/api/todo/no-validate-body.ts b/apps/example-todo-app/pages/api/todo/no-validate-body.ts index 02e898b27..85ae16190 100644 --- a/apps/example-todo-app/pages/api/todo/no-validate-body.ts +++ b/apps/example-todo-app/pages/api/todo/no-validate-body.ts @@ -1,7 +1,5 @@ -import { - checkRouteSpec, - withRouteSpecWithoutValidateGetRequestBody, -} from "lib/middlewares" +import { checkRouteSpec } from "nextlove" +import { withRouteSpecWithoutValidateGetRequestBody } from "lib/middlewares" import { z } from "zod" export const route_spec = checkRouteSpec({