Skip to content

Commit

Permalink
chore: rename "runnerOptions" to "remoteRunner"
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Sep 26, 2024
1 parent dd6e3d5 commit 9ede269
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/guide/api-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ function createWorkerdDevEnvironment(name: string, config: ResolvedConfig, conte
...context.options,
},
hot,
runnerOptions: {
remoteRunner: {
transport,
},
})
Expand Down Expand Up @@ -797,7 +797,7 @@ function createWorkerEnvironment(name, config, context) {
const worker = new Worker('./worker.js')
return new DevEnvironment(name, config, {
hot: /* custom hot channel */,
runnerOptions: {
remoteRunner: {
transport: new RemoteEnvironmentTransport({
send: (data) => worker.postMessage(data),
onMessage: (listener) => worker.on('message', listener),
Expand Down
12 changes: 6 additions & 6 deletions packages/vite/src/node/server/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import type {
} from '../config'
import { getDefaultResolvedEnvironmentOptions } from '../config'
import { mergeConfig, promiseWithResolvers } from '../utils'
import type { FetchModuleOptions } from '../ssr/fetchModule'
import { fetchModule } from '../ssr/fetchModule'
import type { DepsOptimizer } from '../optimizer'
import { isDepOptimizationDisabled } from '../optimizer'
Expand All @@ -35,7 +34,8 @@ import type { RemoteEnvironmentTransport } from './environmentTransport'
export interface DevEnvironmentContext {
hot: false | HotChannel
options?: EnvironmentOptions
runnerOptions?: FetchModuleOptions & {
remoteRunner?: {
inlineSourceMap?: boolean
transport?: RemoteEnvironmentTransport
}
depsOptimizer?: DepsOptimizer
Expand All @@ -49,7 +49,7 @@ export class DevEnvironment extends BaseEnvironment {
/**
* @internal
*/
_ssrRunnerOptions: FetchModuleOptions | undefined
_remoteRunnerOptions: DevEnvironmentContext['remoteRunner']

get pluginContainer(): EnvironmentPluginContainer {
if (!this._pluginContainer)
Expand Down Expand Up @@ -123,8 +123,8 @@ export class DevEnvironment extends BaseEnvironment {
this._onCrawlEndCallbacks.forEach((cb) => cb())
})

this._ssrRunnerOptions = context.runnerOptions ?? {}
context.runnerOptions?.transport?.register(this)
this._remoteRunnerOptions = context.remoteRunner ?? {}
context.remoteRunner?.transport?.register(this)

this.hot.on('vite:invalidate', async ({ path, message }) => {
invalidateModule(this, {
Expand Down Expand Up @@ -172,7 +172,7 @@ export class DevEnvironment extends BaseEnvironment {
options?: FetchFunctionOptions,
): Promise<FetchResult> {
return fetchModule(this, id, importer, {
...this._ssrRunnerOptions,
...this._remoteRunnerOptions,
...options,
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('running module runner inside a worker', () => {
dev: {
createEnvironment: (name, config) => {
return new DevEnvironment(name, config, {
runnerOptions: {
remoteRunner: {
transport: new RemoteEnvironmentTransport({
send: (data) => worker.postMessage(data),
onMessage: (handler) => worker.on('message', handler),
Expand Down

0 comments on commit 9ede269

Please sign in to comment.