( environment: ScanEnvironment, depImports: Record<string, string>, missing: Record<string, string>, entries: string[], jsxOptions: OxcTransformOptions['jsx'], )
| 361 | const svelteModuleRE = /\smodule\b/i |
| 362 | |
| 363 | function rolldownScanPlugin( |
| 364 | environment: ScanEnvironment, |
| 365 | depImports: Record<string, string>, |
| 366 | missing: Record<string, string>, |
| 367 | entries: string[], |
| 368 | jsxOptions: OxcTransformOptions['jsx'], |
| 369 | ): Plugin[] { |
| 370 | const seen = new Map<string, string | undefined>() |
| 371 | async function resolveId( |
| 372 | id: string, |
| 373 | importer?: string, |
| 374 | options?: Parameters<EnvironmentPluginContainer['resolveId']>[2], |
| 375 | ): Promise<PartialResolvedId | null> { |
| 376 | return environment.pluginContainer.resolveId( |
| 377 | id, |
| 378 | importer && normalizePath(importer), |
| 379 | { scan: true, ...options }, |
| 380 | ) |
| 381 | } |
| 382 | const resolve = async ( |
| 383 | id: string, |
| 384 | importer?: string, |
| 385 | options?: Parameters<typeof resolveId>[2], |
| 386 | ) => { |
| 387 | const key = JSON.stringify([ |
| 388 | id, |
| 389 | importer && path.dirname(importer), |
| 390 | options, |
| 391 | ]) |
| 392 | if (seen.has(key)) { |
| 393 | return seen.get(key) |
| 394 | } |
| 395 | const resolved = await resolveId(id, importer, options) |
| 396 | const res = resolved?.id |
| 397 | seen.set(key, res) |
| 398 | return res |
| 399 | } |
| 400 | |
| 401 | const optimizeDepsOptions = environment.config.optimizeDeps |
| 402 | const include = optimizeDepsOptions.include |
| 403 | const exclude = [ |
| 404 | ...(optimizeDepsOptions.exclude ?? []), |
| 405 | '@vite/client', |
| 406 | '@vite/env', |
| 407 | ] |
| 408 | |
| 409 | const externalUnlessEntry = ({ path }: { path: string }) => ({ |
| 410 | id: path, |
| 411 | external: !entries.includes(path), |
| 412 | }) |
| 413 | |
| 414 | const doTransformGlobImport = async ( |
| 415 | contents: string, |
| 416 | id: string, |
| 417 | loader: Loader, |
| 418 | ) => { |
| 419 | let transpiledContents: string |
| 420 | // transpile because `transformGlobImport` only expects js |
no outgoing calls
no test coverage detected