diff --git a/packages/plugin-rsc/examples/basic/src/framework/entry.rsc.tsx b/packages/plugin-rsc/examples/basic/src/framework/entry.rsc.tsx index e26f0b674..6518b40da 100644 --- a/packages/plugin-rsc/examples/basic/src/framework/entry.rsc.tsx +++ b/packages/plugin-rsc/examples/basic/src/framework/entry.rsc.tsx @@ -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 diff --git a/packages/plugin-rsc/examples/custom-server-function/src/framework/entry.rsc.tsx b/packages/plugin-rsc/examples/custom-server-function/src/framework/entry.rsc.tsx index c9cf5c4b3..786ce67f7 100644 --- a/packages/plugin-rsc/examples/custom-server-function/src/framework/entry.rsc.tsx +++ b/packages/plugin-rsc/examples/custom-server-function/src/framework/entry.rsc.tsx @@ -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 @@ -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 { diff --git a/packages/plugin-rsc/examples/starter-extra/src/framework/entry.rsc.tsx b/packages/plugin-rsc/examples/starter-extra/src/framework/entry.rsc.tsx index 0d915b5bd..ebb47a1b1 100644 --- a/packages/plugin-rsc/examples/starter-extra/src/framework/entry.rsc.tsx +++ b/packages/plugin-rsc/examples/starter-extra/src/framework/entry.rsc.tsx @@ -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 @@ -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 { diff --git a/packages/plugin-rsc/examples/starter/src/framework/entry.rsc.tsx b/packages/plugin-rsc/examples/starter/src/framework/entry.rsc.tsx index c9cf5c4b3..786ce67f7 100644 --- a/packages/plugin-rsc/examples/starter/src/framework/entry.rsc.tsx +++ b/packages/plugin-rsc/examples/starter/src/framework/entry.rsc.tsx @@ -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 @@ -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 { diff --git a/packages/plugin-rsc/examples/starter/vite.config.ts b/packages/plugin-rsc/examples/starter/vite.config.ts index 9b9c9e014..58a70d0f9 100644 --- a/packages/plugin-rsc/examples/starter/vite.config.ts +++ b/packages/plugin-rsc/examples/starter/vite.config.ts @@ -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 }), diff --git a/packages/plugin-rsc/examples/use-cache/src/framework/entry.rsc.tsx b/packages/plugin-rsc/examples/use-cache/src/framework/entry.rsc.tsx index c9cf5c4b3..786ce67f7 100644 --- a/packages/plugin-rsc/examples/use-cache/src/framework/entry.rsc.tsx +++ b/packages/plugin-rsc/examples/use-cache/src/framework/entry.rsc.tsx @@ -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 @@ -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 { diff --git a/packages/plugin-rsc/src/plugin.ts b/packages/plugin-rsc/src/plugin.ts index a87a471ee..a8c61e9ce 100644 --- a/packages/plugin-rsc/src/plugin.ts +++ b/packages/plugin-rsc/src/plugin.ts @@ -175,7 +175,7 @@ export type RscPluginOptions = { */ entries?: Partial> - /** @default { enviornmentName: "rsc", entryName: "index" } */ + /** @default { environmentName: "rsc", entryName: "index" } */ serverHandler?: | { environmentName: string diff --git a/packages/plugin-rsc/src/plugins/import-environment.ts b/packages/plugin-rsc/src/plugins/import-environment.ts index 80b273386..a2cc8f200 100644 --- a/packages/plugin-rsc/src/plugins/import-environment.ts +++ b/packages/plugin-rsc/src/plugins/import-environment.ts @@ -9,7 +9,7 @@ import type { RscPluginManager } from '../plugin' import { createVirtualPlugin, normalizeRelativePath, - normalizeRollupOpitonsInput, + normalizeRollupOptionsInput, } from './utils' import { evalValue } from './vite-utils' @@ -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) { diff --git a/packages/plugin-rsc/src/plugins/utils.ts b/packages/plugin-rsc/src/plugins/utils.ts index 6c993e732..a5024a12b 100644 --- a/packages/plugin-rsc/src/plugins/utils.ts +++ b/packages/plugin-rsc/src/plugins/utils.ts @@ -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 } @@ -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 { if (typeof input === 'string') {