-
Notifications
You must be signed in to change notification settings - Fork 0
[noop] Typecheck react-noop-renderer against host config and renderer API
#644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
everettbu
wants to merge
3
commits into
main
from
sebbie/03-02-_noop_typecheck_react-noop-renderer_against_host_config_and_renderer_api
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
packages/react-client/src/forks/ReactFlightClientConfig.noop.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /** | ||
| * Copyright (c) Meta Platforms, Inc. and affiliates. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| * @flow | ||
| */ | ||
|
|
||
| // This is a host config that's used for the internal `react-noop-renderer` package. | ||
| // | ||
| // Its API lets you pass the host config as an argument. | ||
| // However, inside the `react-server` we treat host config as a module. | ||
| // This file is a shim between two worlds. | ||
| // | ||
| // It works because the `react-server` bundle is wrapped in something like: | ||
| // | ||
| // module.exports = function ($$$config) { | ||
| // /* renderer code */ | ||
| // } | ||
| // | ||
| // So `$$$config` looks like a global variable, but it's | ||
| // really an argument to a top-level wrapping function. | ||
|
|
||
| declare const $$$config: $FlowFixMe; | ||
|
|
||
| export opaque type ModuleLoading = mixed; | ||
| export opaque type ServerConsumerModuleMap = mixed; | ||
| export opaque type ServerManifest = mixed; | ||
| export opaque type ServerReferenceId = string; | ||
| export opaque type ClientReferenceMetadata = mixed; | ||
| export opaque type ClientReference<T> = mixed; // eslint-disable-line no-unused-vars | ||
| export const resolveClientReference = $$$config.resolveClientReference; | ||
| export const resolveServerReference = $$$config.resolveServerReference; | ||
| export const preloadModule = $$$config.preloadModule; | ||
| export const requireModule = $$$config.requireModule; | ||
| export const getModuleDebugInfo = $$$config.getModuleDebugInfo; | ||
| export const dispatchHint = $$$config.dispatchHint; | ||
| export const prepareDestinationForModule = | ||
| $$$config.prepareDestinationForModule; | ||
| export const usedWithSSR = true; | ||
|
|
||
| export opaque type Source = mixed; | ||
|
|
||
| export opaque type StringDecoder = mixed; | ||
|
|
||
| export const createStringDecoder = $$$config.createStringDecoder; | ||
| export const readPartialStringChunk = $$$config.readPartialStringChunk; | ||
| export const readFinalStringChunk = $$$config.readFinalStringChunk; | ||
|
|
||
| export const bindToConsole = $$$config.bindToConsole; | ||
|
|
||
| export const rendererVersion = $$$config.rendererVersion; | ||
| export const rendererPackageName = $$$config.rendererPackageName; | ||
|
|
||
| export const checkEvalAvailabilityOnceDev = | ||
| $$$config.checkEvalAvailabilityOnceDev; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /** | ||
| * Copyright (c) Meta Platforms, Inc. and affiliates. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| * @flow | ||
| */ | ||
|
|
||
| export type HostContext = Object; | ||
|
|
||
| export type TextInstance = { | ||
| text: string, | ||
| id: number, | ||
| parent: number, | ||
| hidden: boolean, | ||
| context: HostContext, | ||
| }; | ||
|
|
||
| export type Instance = { | ||
| type: string, | ||
| id: number, | ||
| parent: number, | ||
| children: Array<Instance | TextInstance>, | ||
| text: string | null, | ||
| prop: any, | ||
| hidden: boolean, | ||
| context: HostContext, | ||
| }; | ||
|
|
||
| export type PublicInstance = Instance; | ||
|
|
||
| export type TransitionStatus = mixed; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug:
boundary.statusshould beboundary.stateThe
SuspenseInstancetype (line 37-40) defines astateproperty, notstatus. The analogous methodwriteCompletedBoundaryInstruction(line 310) correctly usesboundary.state = 'complete', but this line incorrectly usesboundary.status. The$FlowFixMe[prop-missing]suppression hides a real bug rather than just a harmless type mismatch.Since the goal of this PR is to set up typechecking for the noop renderer, this is an opportunity to fix the property name rather than suppress it:
Prompt To Fix With AI