From e4ad3eafc7ca18712326d9459cb2842423f7681d Mon Sep 17 00:00:00 2001 From: William Johnston Date: Fri, 22 Oct 2021 09:46:28 -0700 Subject: [PATCH] feat: (#591) creating @faustjs/next/server export --- packages/next/package.json | 4 ++++ packages/next/server.d.ts | 1 + packages/next/src/HeadlessProvider.tsx | 2 +- packages/next/src/export/index.ts | 2 +- packages/next/src/export/log.ts | 1 + packages/next/src/export/server.ts | 1 + packages/next/src/{ => server}/getProps.tsx | 6 +++--- packages/next/src/server/index.ts | 1 + 8 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 packages/next/server.d.ts create mode 100644 packages/next/src/export/log.ts create mode 100644 packages/next/src/export/server.ts rename packages/next/src/{ => server}/getProps.tsx (98%) create mode 100644 packages/next/src/server/index.ts diff --git a/packages/next/package.json b/packages/next/package.json index 1f341c6f8..eb1a08b4c 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -22,6 +22,10 @@ "import": "./dist/mjs/export/log.js", "require": "./dist/cjs/export/log.js" }, + "./server": { + "import": "./dist/mjs/export/server.js", + "require": "./dist/cjs/export/server.js" + }, "./utils": { "import": "./dist/mjs/export/utils.js", "require": "./dist/cjs/export/utils.js" diff --git a/packages/next/server.d.ts b/packages/next/server.d.ts new file mode 100644 index 000000000..38a65ded9 --- /dev/null +++ b/packages/next/server.d.ts @@ -0,0 +1 @@ +export * from './dist/cjs/export/server'; diff --git a/packages/next/src/HeadlessProvider.tsx b/packages/next/src/HeadlessProvider.tsx index 772ab8a1e..f348f14d4 100644 --- a/packages/next/src/HeadlessProvider.tsx +++ b/packages/next/src/HeadlessProvider.tsx @@ -5,7 +5,7 @@ import { AUTH_CLIENT_CACHE_PROP, CLIENT_CACHE_PROP, PageProps, -} from './getProps'; +} from './server/getProps'; import { HeadlessContext } from './gqty/client'; /** diff --git a/packages/next/src/export/index.ts b/packages/next/src/export/index.ts index 0b2fe722e..7cc56010b 100644 --- a/packages/next/src/export/index.ts +++ b/packages/next/src/export/index.ts @@ -1,6 +1,6 @@ export * from '../gqty/client'; export * from '../config/config'; -export * from '../getProps'; +export * from '../server/getProps'; export * from '../HeadlessProvider'; export * from '../utils'; export * from '../config/withFaust'; diff --git a/packages/next/src/export/log.ts b/packages/next/src/export/log.ts new file mode 100644 index 000000000..bc3ff202a --- /dev/null +++ b/packages/next/src/export/log.ts @@ -0,0 +1 @@ +export * from '../log'; diff --git a/packages/next/src/export/server.ts b/packages/next/src/export/server.ts new file mode 100644 index 000000000..c51a04d02 --- /dev/null +++ b/packages/next/src/export/server.ts @@ -0,0 +1 @@ +export * from '../server'; diff --git a/packages/next/src/getProps.tsx b/packages/next/src/server/getProps.tsx similarity index 98% rename from packages/next/src/getProps.tsx rename to packages/next/src/server/getProps.tsx index 24f1f28f9..a02f7de08 100644 --- a/packages/next/src/getProps.tsx +++ b/packages/next/src/server/getProps.tsx @@ -12,8 +12,8 @@ import { import { RouterContext } from 'next/dist/shared/lib/router-context'; import React, { FunctionComponent, ComponentClass } from 'react'; -import { config } from './config/config'; -import { getClient, HeadlessContext } from './gqty/client'; +import { config } from '../config/config'; +import { getClient, HeadlessContext } from '../gqty/client'; import { hasCategoryId, @@ -23,7 +23,7 @@ import { hasPostId, hasPostSlug, hasPostUri, -} from './utils'; +} from '../utils'; export const CLIENT_CACHE_PROP = '__CLIENT_CACHE_PROP'; export const AUTH_CLIENT_CACHE_PROP = '__AUTH_CLIENT_CACHE_PROP'; diff --git a/packages/next/src/server/index.ts b/packages/next/src/server/index.ts new file mode 100644 index 000000000..5104c7a90 --- /dev/null +++ b/packages/next/src/server/index.ts @@ -0,0 +1 @@ +export * from './getProps';