MCPcopy
hub / github.com/vitejs/vite / workerFileToUrl

Function workerFileToUrl

packages/vite/src/node/plugins/worker.ts:310–326  ·  view source on GitHub ↗
(
  config: ResolvedConfig,
  id: string,
)

Source from the content-addressed store, hash-verified

308export const workerAssetUrlRE: RegExp = /__VITE_WORKER_ASSET__([a-z\d]{8})__/g
309
310export async function workerFileToUrl(
311 config: ResolvedConfig,
312 id: string,
313): Promise<WorkerBundle> {
314 const workerOutput = workerOutputCaches.get(config.mainConfig || config)!
315 const bundle = await bundleWorkerEntry(config, id)
316 workerOutput.saveAsset(
317 {
318 fileName: bundle.entryFilename,
319 originalFileName: null,
320 originalFileNames: [],
321 source: bundle.entryCode,
322 },
323 config.logger,
324 )
325 return bundle
326}
327
328export function webWorkerPostPlugin(_config: ResolvedConfig): Plugin {
329 return {

Callers 2

handlerFunction · 0.90
handlerFunction · 0.85

Calls 3

bundleWorkerEntryFunction · 0.85
saveAssetMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected