Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { parseRenderRequest } from './request.tsx'
// The schema of payload which is serialized into RSC stream on rsc environment
// and deserialized on ssr/client environments.
export type RscPayload = {
// this demo renders/serializes/deserizlies entire root html element
// this demo renders/serializes/deserializes the entire root HTML element
// but this mechanism can be changed to render/fetch different parts of components
// based on your own route conventions.
root: React.ReactNode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { parseRenderRequest } from './request.tsx'
// The schema of payload which is serialized into RSC stream on rsc environment
// and deserialized on ssr/client environments.
export type RscPayload = {
// this demo renders/serializes/deserizlies entire root html element
// this demo renders/serializes/deserializes the entire root HTML element
// but this mechanism can be changed to render/fetch different parts of components
// based on your own route conventions.
root: React.ReactNode
Expand All @@ -23,8 +23,8 @@ export type RscPayload = {
formState?: ReactFormState
}

// the plugin by default assumes `rsc` entry having default export of request handler.
// however, how server entries are executed can be customized by registering own server handler.
// The plugin assumes by default that the `rsc` entry has a default export of a request handler.
// However, server entries can be executed differently by registering your own server handler.
export default { fetch: handler }

async function handler(request: Request): Promise<Response> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { parseRenderRequest } from './request.tsx'
// The schema of payload which is serialized into RSC stream on rsc environment
// and deserialized on ssr/client environments.
export type RscPayload = {
// this demo renders/serializes/deserizlies entire root html element
// this demo renders/serializes/deserializes the entire root HTML element
// but this mechanism can be changed to render/fetch different parts of components
// based on your own route conventions.
root: React.ReactNode
Expand All @@ -23,8 +23,8 @@ export type RscPayload = {
formState?: ReactFormState
}

// the plugin by default assumes `rsc` entry having default export of request handler.
// however, how server entries are executed can be customized by registering own server handler.
// The plugin assumes by default that the `rsc` entry has a default export of a request handler.
// However, server entries can be executed differently by registering your own server handler.
export default { fetch: handler }

async function handler(request: Request): Promise<Response> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { parseRenderRequest } from './request.tsx'
// The schema of payload which is serialized into RSC stream on rsc environment
// and deserialized on ssr/client environments.
export type RscPayload = {
// this demo renders/serializes/deserizlies entire root html element
// this demo renders/serializes/deserializes the entire root HTML element
// but this mechanism can be changed to render/fetch different parts of components
// based on your own route conventions.
root: React.ReactNode
Expand All @@ -23,8 +23,8 @@ export type RscPayload = {
formState?: ReactFormState
}

// the plugin by default assumes `rsc` entry having default export of request handler.
// however, how server entries are executed can be customized by registering own server handler.
// The plugin assumes by default that the `rsc` entry has a default export of a request handler.
// However, server entries can be executed differently by registering your own server handler.
export default { fetch: handler }

async function handler(request: Request): Promise<Response> {
Expand Down
5 changes: 3 additions & 2 deletions packages/plugin-rsc/examples/starter/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ export default defineConfig({
// `entries` option is only a shorthand for specifying each `rollupOptions.input` below
// > entries: { rsc, ssr, client },
//
// by default, the plugin setup request handler based on `default export` of `rsc` environment `rollupOptions.input.index`.
// This can be disabled when setting up own server handler e.g. `@cloudflare/vite-plugin`.
// By default, the plugin sets up a request handler based on the default export of
// the `rsc` environment's `rollupOptions.input.index`.
// This can be disabled when setting up your own server handler, e.g. `@cloudflare/vite-plugin`.
// > serverHandler: false
}),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { parseRenderRequest } from './request.tsx'
// The schema of payload which is serialized into RSC stream on rsc environment
// and deserialized on ssr/client environments.
export type RscPayload = {
// this demo renders/serializes/deserizlies entire root html element
// this demo renders/serializes/deserializes the entire root HTML element
// but this mechanism can be changed to render/fetch different parts of components
// based on your own route conventions.
root: React.ReactNode
Expand All @@ -23,8 +23,8 @@ export type RscPayload = {
formState?: ReactFormState
}

// the plugin by default assumes `rsc` entry having default export of request handler.
// however, how server entries are executed can be customized by registering own server handler.
// The plugin assumes by default that the `rsc` entry has a default export of a request handler.
// However, server entries can be executed differently by registering your own server handler.
export default { fetch: handler }

async function handler(request: Request): Promise<Response> {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-rsc/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export type RscPluginOptions = {
*/
entries?: Partial<Record<'client' | 'ssr' | 'rsc', string>>

/** @default { enviornmentName: "rsc", entryName: "index" } */
/** @default { environmentName: "rsc", entryName: "index" } */
serverHandler?:
| {
environmentName: string
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-rsc/src/plugins/import-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { RscPluginManager } from '../plugin'
import {
createVirtualPlugin,
normalizeRelativePath,
normalizeRollupOpitonsInput,
normalizeRollupOptionsInput,
} from './utils'
import { evalValue } from './vite-utils'

Expand All @@ -31,7 +31,7 @@ export function ensureEnvironmentImportsEntryFallback({
}: ResolvedConfig): void {
for (const [name, config] of Object.entries(environments)) {
if (name === 'client') continue
const input = normalizeRollupOpitonsInput(
const input = normalizeRollupOptionsInput(
config.build?.rollupOptions?.input,
)
if (Object.keys(input).length === 0) {
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-rsc/src/plugins/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function getFallbackRollupEntry(
name: string
source: string
} {
const inputEntries = Object.entries(normalizeRollupOpitonsInput(input))
const inputEntries = Object.entries(normalizeRollupOptionsInput(input))
if (inputEntries.length === 1) {
const [name, source] = inputEntries[0]!
return { name, source }
Expand All @@ -110,7 +110,7 @@ export function getFallbackRollupEntry(
// normalize to object form
// https://rollupjs.org/configuration-options/#input
// https://rollupjs.org/configuration-options/#output-entryfilenames
export function normalizeRollupOpitonsInput(
export function normalizeRollupOptionsInput(
input: Rollup.InputOptions['input'] = {},
): Record<string, string> {
if (typeof input === 'string') {
Expand Down
Loading