Skip to content

Commit

Permalink
Revert "Force resolution to use vendored React"
Browse files Browse the repository at this point in the history
This reverts commit 98f02ec42df4fd0ea84b05c529d5b1d3fb70fd7c.

Try to find out why it's not aliased in the first place
  • Loading branch information
eps1lon committed Apr 21, 2024
1 parent 2ed5a77 commit 4e77092
Show file tree
Hide file tree
Showing 130 changed files with 166 additions and 166 deletions.
2 changes: 1 addition & 1 deletion packages/next/src/build/babel/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default (
require('./plugins/jsx-pragma'),
{
// This produces the following injected import for modules containing JSX:
// import React from 'next/dist/compiled/react';
// import React from 'react';
// var __jsx = React.createElement;
module: 'react',
importAs: 'React',
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'next/dist/compiled/react'
import React from 'react'
import ReactRefreshWebpackPlugin from 'next/dist/compiled/@next/react-refresh-utils/dist/ReactRefreshWebpackPlugin'
import { yellow, bold } from '../lib/picocolors'
import crypto from 'crypto'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable import/no-extraneous-dependencies */
import { createClientModuleProxy } from 'next/dist/compiled/react-server-dom-webpack/server.edge'
import { createClientModuleProxy } from 'react-server-dom-webpack/server.edge'

// Re-assign to make it typed.
export const createProxy: (moduleId: string) => any = createClientModuleProxy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable import/no-extraneous-dependencies */
import { registerServerReference as flightRegisterServerReference } from 'next/dist/compiled/react-server-dom-webpack/server.edge'
import { registerServerReference as flightRegisterServerReference } from 'react-server-dom-webpack/server.edge'

export function registerServerReference(id: string, action: any) {
return flightRegisterServerReference(action, id, null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ declare module 'next' {
declare module 'next/link' {
import type { LinkProps as OriginalLinkProps } from 'next/dist/client/link.js'
import type { AnchorHTMLAttributes, DetailedHTMLProps } from 'next/dist/compiled/react'
import type { AnchorHTMLAttributes, DetailedHTMLProps } from 'react'
import type { UrlObject } from 'url'
type LinkRestProps = Omit<
Expand Down
6 changes: 3 additions & 3 deletions packages/next/src/client/app-index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import '../build/polyfills/polyfill-module'
// @ts-ignore react-dom/client exists when using React 18
import ReactDOMClient from 'next/dist/compiled/react-dom/client'
import React, { use } from 'next/dist/compiled/react'
import ReactDOMClient from 'react-dom/client'
import React, { use } from 'react'
// @ts-ignore
// eslint-disable-next-line import/no-extraneous-dependencies
import { createFromReadableStream } from 'next/dist/compiled/react-server-dom-webpack/client'
import { createFromReadableStream } from 'react-server-dom-webpack/client'

import { HeadManagerContext } from '../shared/lib/head-manager-context.shared-runtime'
import onRecoverableError from './on-recoverable-error'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/client/compat/router.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContext } from 'next/dist/compiled/react'
import { useContext } from 'react'
import { RouterContext } from '../../shared/lib/router-context.shared-runtime'
import type { NextRouter } from '../router'

Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/client/components/app-router-announcer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useRef, useState } from 'next/dist/compiled/react'
import { createPortal } from 'next/dist/compiled/react-dom'
import { useEffect, useRef, useState } from 'react'
import { createPortal } from 'react-dom'
import type { FlightRouterState } from '../../server/app-render/types'

const ANNOUNCER_TYPE = 'next-route-announcer'
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/client/components/app-router.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import type { ReactNode } from 'next/dist/compiled/react'
import type { ReactNode } from 'react'
import React, {
use,
useEffect,
Expand All @@ -9,7 +9,7 @@ import React, {
startTransition,
useInsertionEffect,
useDeferredValue,
} from 'next/dist/compiled/react'
} from 'react'
import {
AppRouterContext,
LayoutRouterContext,
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/client/components/default-layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'next/dist/compiled/react'
import React from 'react'

export default function DefaultLayout({
children,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import React from 'next/dist/compiled/react'
import React from 'react'
import { NotFoundBoundary } from './not-found-boundary'

export function bailOnNotFound() {
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/client/components/error-boundary.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import React from 'next/dist/compiled/react'
import React from 'react'
import { usePathname } from './navigation'
import { isNextRouterError } from './is-next-router-error'
import { staticGenerationAsyncStorage } from './static-generation-async-storage.external'
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/client/components/layout-router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import React, {
startTransition,
Suspense,
useDeferredValue,
} from 'next/dist/compiled/react'
import ReactDOM from 'next/dist/compiled/react-dom'
} from 'react'
import ReactDOM from 'react-dom'
import {
LayoutRouterContext,
GlobalLayoutRouterContext,
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/client/components/navigation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContext, useMemo } from 'next/dist/compiled/react'
import { useContext, useMemo } from 'react'
import type { FlightRouterState } from '../../server/app-render/types'
import {
AppRouterContext,
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/client/components/not-found-boundary.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import React, { useContext } from 'next/dist/compiled/react'
import React, { useContext } from 'react'
import { usePathname } from './navigation'
import { isNotFoundError } from './not-found'
import { warnOnce } from '../../shared/lib/utils/warn-once'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/client/components/not-found-error.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'next/dist/compiled/react'
import React from 'react'

const styles: Record<string, React.CSSProperties> = {
error: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'next/dist/compiled/react'
import * as React from 'react'
import { ACTION_UNHANDLED_ERROR, type OverlayState } from '../shared'

import { ShadowPortal } from '../internal/components/ShadowPortal'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactNode } from 'next/dist/compiled/react'
import { useCallback, useEffect, startTransition, useMemo } from 'next/dist/compiled/react'
import type { ReactNode } from 'react'
import { useCallback, useEffect, startTransition, useMemo } from 'react'
import stripAnsi from 'next/dist/compiled/strip-ansi'
import formatWebpackMessages from '../internal/helpers/format-webpack-messages'
import { useRouter } from '../../navigation'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Anser from 'next/dist/compiled/anser'
import * as React from 'next/dist/compiled/react'
import * as React from 'react'
import type { StackFrame } from 'next/dist/compiled/stacktrace-parser'
import stripAnsi from 'next/dist/compiled/strip-ansi'
import { getFrameSource } from '../../helpers/stack-frame'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'next/dist/compiled/react'
import * as React from 'react'
import { useOnClickOutside } from '../../hooks/use-on-click-outside'

export type DialogProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'next/dist/compiled/react'
import * as React from 'react'

export type DialogBodyProps = {
children?: React.ReactNode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'next/dist/compiled/react'
import * as React from 'react'

export type DialogContentProps = {
children?: React.ReactNode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'next/dist/compiled/react'
import * as React from 'react'

export type DialogHeaderProps = {
children?: React.ReactNode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'next/dist/compiled/react'
import * as React from 'react'
import { CloseIcon } from '../../icons/CloseIcon'

export type LeftRightDialogHeaderProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import allyTrap from './maintain--tab-focus'
import * as React from 'next/dist/compiled/react'
import * as React from 'react'
import { lock, unlock } from './body-locker'

export type OverlayProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'next/dist/compiled/react'
import { createPortal } from 'next/dist/compiled/react-dom'
import * as React from 'react'
import { createPortal } from 'react-dom'

export function ShadowPortal({ children }: { children: React.ReactNode }) {
let portalNode = React.useRef<HTMLElement | null>(null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'next/dist/compiled/react'
import React from 'react'
import { useOpenInEditor } from '../../helpers/use-open-in-editor'

type EditorLinkProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Anser from 'next/dist/compiled/anser'
import * as React from 'next/dist/compiled/react'
import * as React from 'react'
import { HotlinkedText } from '../hot-linked-text'
import { EditorLink } from './EditorLink'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'next/dist/compiled/react'
import * as React from 'react'

export type ToastProps = {
children?: React.ReactNode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'next/dist/compiled/react'
import React from 'react'
import type { VersionInfo } from '../../../../../../server/dev/parse-version-info'

export function VersionStalenessInfo(props: VersionInfo) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'next/dist/compiled/react'
import React from 'react'
import {
decodeMagicIdentifier,
MAGIC_IDENTIFIER_REGEX,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'next/dist/compiled/react'
import * as React from 'react'
import type { VersionInfo } from '../../../../../server/dev/parse-version-info'
import {
Dialog,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect, useMemo, useCallback } from 'next/dist/compiled/react'
import { useState, useEffect, useMemo, useCallback } from 'react'
import {
ACTION_UNHANDLED_ERROR,
ACTION_UNHANDLED_REJECTION,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'next/dist/compiled/react'
import React from 'react'
import type { ComponentStackFrame } from '../../helpers/parse-component-stack'
import { useOpenInEditor } from '../../helpers/use-open-in-editor'
import { HotlinkedText } from '../../components/hot-linked-text'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMemo, Fragment, useState } from 'next/dist/compiled/react'
import { useMemo, Fragment, useState } from 'react'
import type { ComponentStackFrame } from '../../helpers/parse-component-stack'
import { CollapseIcon } from '../../icons/CollapseIcon'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'next/dist/compiled/react'
import * as React from 'react'
import { CodeFrame } from '../../components/CodeFrame'
import type { ReadyRuntimeError } from '../../helpers/getErrorByType'
import { noop as css } from '../../helpers/noop-template'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'next/dist/compiled/react'
import * as React from 'react'
import type { VersionInfo } from '../../../../../server/dev/parse-version-info'
import { Dialog, DialogContent, DialogHeader } from '../components/Dialog'
import { Overlay } from '../components/Overlay'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect } from 'next/dist/compiled/react'
import { useEffect } from 'react'
import { hydrationErrorState } from './hydration-error-info'
import { isNextRouterError } from '../../../is-next-router-error'
import { isHydrationError } from '../../../is-hydration-error'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useCallback } from 'next/dist/compiled/react'
import { useCallback } from 'react'

export function useOpenInEditor({
file,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useCallback, useContext, useEffect, useRef } from 'next/dist/compiled/react'
import { useCallback, useContext, useEffect, useRef } from 'react'
import { GlobalLayoutRouterContext } from '../../../../../shared/lib/app-router-context.shared-runtime'
import { getSocketUrl } from './get-socket-url'
import type { TurbopackMsgToBrowser } from '../../../../../server/dev/hot-reloader-types'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'next/dist/compiled/react'
import * as React from 'react'

export function useOnClickOutside(
el: Node | null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'next/dist/compiled/react'
import * as React from 'react'

const CloseIcon = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'next/dist/compiled/react'
import * as React from 'react'
import { noop as css } from '../helpers/noop-template'

export function Base() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'next/dist/compiled/react'
import * as React from 'react'
import { noop as css } from '../helpers/noop-template'

export function CssReset() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'next/dist/compiled/react'
import * as React from 'react'

type ErrorBoundaryProps = {
children?: React.ReactNode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'next/dist/compiled/react'
import * as React from 'react'

import * as Bus from './bus'
import { ShadowPortal } from '../internal/components/ShadowPortal'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useReducer } from 'next/dist/compiled/react'
import { useReducer } from 'react'

import type { StackFrame } from 'next/dist/compiled/stacktrace-parser'
import type { VersionInfo } from '../../../server/dev/parse-version-info'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/client/components/redirect-boundary.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use client'
import React, { useEffect } from 'next/dist/compiled/react'
import React, { useEffect } from 'react'
import type { AppRouterInstance } from '../../shared/lib/app-router-context.shared-runtime'
import { useRouter } from './navigation'
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import React, { useContext } from 'next/dist/compiled/react'
import React, { useContext } from 'react'
import { TemplateContext } from '../../shared/lib/app-router-context.shared-runtime'

export default function RenderFromTemplateContext(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'next/dist/compiled/react'
import React from 'react'
import type {
FlightData,
FlightRouterState,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'next/dist/compiled/react'
import React from 'react'
import { clearCacheNodeDataForSegmentPath } from './clear-cache-node-data-for-segment-path'
import type { CacheNode } from '../../../shared/lib/app-router-context.shared-runtime'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'next/dist/compiled/react'
import React from 'react'
import type { FlightRouterState } from '../../../server/app-render/types'
import type { CacheNode } from '../../../shared/lib/app-router-context.shared-runtime'
import { createInitialRouterState } from './create-initial-router-state'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ReactNode } from 'next/dist/compiled/react'
import type { ReactNode } from 'react'
import type { CacheNode } from '../../../shared/lib/app-router-context.shared-runtime'
import type {
FlightRouterState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// @ts-ignore
// eslint-disable-next-line import/no-extraneous-dependencies
// import { createFromFetch } from 'next/dist/compiled/react-server-dom-webpack/client'
// import { createFromFetch } from 'react-server-dom-webpack/client'
const { createFromFetch } = (
!!process.env.NEXT_RUNTIME
? // eslint-disable-next-line import/no-extraneous-dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'next/dist/compiled/react'
import React from 'react'
import { fillCacheWithNewSubTreeData } from './fill-cache-with-new-subtree-data'
import type { CacheNode } from '../../../shared/lib/app-router-context.shared-runtime'
import type { FlightData } from '../../../server/app-render/types'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'next/dist/compiled/react'
import React from 'react'
import { fillLazyItemsTillLeafWithHead } from './fill-lazy-items-till-leaf-with-head'
import type { CacheNode } from '../../../shared/lib/app-router-context.shared-runtime'
import type { FlightData } from '../../../server/app-render/types'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'next/dist/compiled/react'
import React from 'react'
import type { FlightData } from '../../../server/app-render/types'
import { invalidateCacheBelowFlightSegmentPath } from './invalidate-cache-below-flight-segmentpath'
import type { CacheNode } from '../../../shared/lib/app-router-context.shared-runtime'
Expand Down

0 comments on commit 4e77092

Please sign in to comment.