From 6581428781e33e82e1e4d4fec07209772bcc7f36 Mon Sep 17 00:00:00 2001 From: Brandon Bayer Date: Mon, 18 Oct 2021 18:32:22 -0400 Subject: [PATCH] more work --- .../packages/next/stdlib}/blitz-app-root.tsx | 92 ++++++---- .../packages/next/stdlib}/error-boundary.tsx | 78 ++++---- nextjs/packages/next/stdlib/index.ts | 2 + .../unit/error-boundary-hook.unit.test.tsx | 50 +++--- .../test/unit/error-boundary.unit.test.tsx | 167 ++++++++++-------- .../babel-preset/src/add-blitz-app-root.ts | 2 +- packages/babel-preset/src/rewrite-imports.ts | 25 +-- packages/core/package.json | 6 +- packages/core/src/index.ts | 4 - packages/core/src/router/router-hooks.ts | 6 +- packages/core/src/types.ts | 27 --- packages/core/types/index.d.ts | 7 - 12 files changed, 242 insertions(+), 224 deletions(-) rename {packages/core/src => nextjs/packages/next/stdlib}/blitz-app-root.tsx (58%) rename {packages/core/src => nextjs/packages/next/stdlib}/error-boundary.tsx (70%) rename packages/core/src/error-boundary.hook.test.tsx => nextjs/test/unit/error-boundary-hook.unit.test.tsx (66%) rename packages/core/src/error-boundary.test.tsx => nextjs/test/unit/error-boundary.unit.test.tsx (70%) delete mode 100644 packages/core/src/types.ts delete mode 100644 packages/core/types/index.d.ts diff --git a/packages/core/src/blitz-app-root.tsx b/nextjs/packages/next/stdlib/blitz-app-root.tsx similarity index 58% rename from packages/core/src/blitz-app-root.tsx rename to nextjs/packages/next/stdlib/blitz-app-root.tsx index 4fd1d0705b..8c1583b382 100644 --- a/packages/core/src/blitz-app-root.tsx +++ b/nextjs/packages/next/stdlib/blitz-app-root.tsx @@ -1,12 +1,16 @@ -import {getPublicDataStore, useAuthorizeIf, useSession} from "next/data-client" -import {BlitzProvider} from "next/data-client" -import {formatWithValidation} from "next/dist/shared/lib/utils" -import {Head} from "next/head" -import {RedirectError} from "next/stdlib" -import {AppProps, BlitzPage} from "next/types" -import React, {ComponentPropsWithoutRef, useEffect} from "react" -import SuperJSON from "superjson" -const debug = require("debug")("blitz:approot") +import { + getPublicDataStore, + useAuthorizeIf, + useSession, + BlitzProvider, +} from '../data-client/index' +import { formatWithValidation } from '../shared/lib/utils' +import { Head } from '../shared/lib/head' +import { RedirectError } from './errors' +import { AppProps, BlitzPage } from '../types/index' +import React, { ComponentPropsWithoutRef, useEffect } from 'react' +import SuperJSON from 'superjson' +const debug = require('debug')('blitz:approot') const customCSS = ` body::before { @@ -34,15 +38,18 @@ const noscriptCSS = ` const NoPageFlicker = () => { return ( -