remove a bunch of dead code / unused variables

This commit is contained in:
Jack Hanford
2021-11-10 14:53:48 -08:00
parent 23bdc6f792
commit 0b48e7272d
4 changed files with 6 additions and 44 deletions

View File

@@ -59,7 +59,6 @@ declare global {
function nextDataFromBunData() {
const {
router: { routes, route, params: paramsList },
problems,
} = globalThis.__BUN_DATA__;
const paramsMap = new Map();
@@ -100,13 +99,13 @@ type RenderRouteInfo = PrivateRouteInfo & {
App: AppComponent;
scroll?: { x: number; y: number } | null;
};
type RenderErrorProps = Omit<RenderRouteInfo, "Component" | "styleSheets">;
const nextDataTag = document.getElementById("__NEXT_DATA__");
const data: typeof window["__NEXT_DATA__"] = nextDataTag
? JSON.parse(document.getElementById("__NEXT_DATA__")!.textContent!)
: nextDataFromBunData();
window.__NEXT_DATA__ = data;
const {
@@ -151,8 +150,6 @@ const headManager: {
} = initHeadManager();
const appElement: HTMLElement | null = document.getElementById("__next");
let lastRenderReject: (() => void) | null;
let webpackHMR: any;
export let router: Router;
let CachedApp: AppComponent = App,
onPerfEntry: (metric: any) => void;

View File

@@ -1,8 +1,5 @@
import { insertStyleSheet } from "./page-loader";
import type {
FallbackMessageContainer,
FallbackStep,
} from "../../../src/api/schema";
import type { FallbackMessageContainer } from "../../../src/api/schema";
var once = false;
function insertNextHeadCount() {
@@ -30,13 +27,9 @@ document.addEventListener("onimportcss", insertGlobalStyleSheet, {
passive: true,
});
import { renderError, _boot, pageLoader } from "./client.development";
import { _boot, pageLoader } from "./client.development";
function renderFallback({
router,
reason,
problems,
}: FallbackMessageContainer) {
function renderFallback({ router }: FallbackMessageContainer) {
const route = router.routes.values[router.route];
if (!document.getElementById("__next")) {

View File

@@ -69,7 +69,7 @@ export default class PageLoader extends NextPageLoader {
);
};
prefetch(route) {
prefetch() {
return Promise.resolve({});
}

View File

@@ -20,7 +20,6 @@ import {
} from "next/dist/shared/lib/utils";
import * as NextDocument from "next/document";
import * as ReactDOMServer from "react-dom/server.browser";
import * as url from "url";
import * as React from "react";
import * as ReactIs from "react-is";
import { BODY_RENDER_TARGET } from "next/constants";
@@ -78,8 +77,8 @@ function getScripts(files: DocumentFiles) {
buildManifest,
isDevelopment,
devOnlyCacheBusterQueryString,
disableOptimizedLoading,
} = context;
const normalScripts = files.allFiles.filter(isJSFile);
const lowPriorityScripts = buildManifest.lowPriorityFiles?.filter(isJSFile);
@@ -97,33 +96,6 @@ function getScripts(files: DocumentFiles) {
});
}
// function fixLink(from: string) {
// if (from.startsWith("/_next/http://") || from.startsWith("/_next/https://"))
// return from.substring("/_next".length);
// return from;
// }
// function cloneWithOverwrittenLink(element: React.ReactElement<any>) {
// const props = { ...element.props };
// if ("href" in element.props) {
// props.href = fixLink(props.href);
// }
// if ("n-href" in element.props) {
// props["n-href"] = fixLink(props["n-href"]);
// }
// if ("n-src" in element.props) {
// props["n-src"] = fixLink(props["n-src"]);
// }
// if ("src" in element.props) {
// props["src"] = fixLink(props.src);
// }
// return React.cloneElement(element, props);
// }
interface DomainLocale {
defaultLocale: string;
domain: string;