(id, importer, environmentName)
| 57 | }) |
| 58 | }, |
| 59 | async resolve(id, importer, environmentName) { |
| 60 | const environment = project.vite.environments[environmentName] |
| 61 | if (!environment) { |
| 62 | throw new Error(`The environment ${environmentName} was not defined in the Vite config.`) |
| 63 | } |
| 64 | const resolved = await environment.pluginContainer.resolveId(id, importer) |
| 65 | if (!resolved) { |
| 66 | return null |
| 67 | } |
| 68 | const file = cleanUrl(resolved.id) |
| 69 | if (resolved.external) { |
| 70 | return { |
| 71 | file, |
| 72 | // this is only used by the module mocker and it always |
| 73 | // standardizes the id to mock "node:url" and "url" at the same time |
| 74 | url: isBuiltin(resolved.id) |
| 75 | ? toBuiltin(resolved.id) |
| 76 | : resolved.id, |
| 77 | id: resolved.id, |
| 78 | } |
| 79 | } |
| 80 | return { |
| 81 | file: cleanUrl(resolved.id), |
| 82 | url: normalizeResolvedIdToUrl(environment, resolved.id), |
| 83 | id: resolved.id, |
| 84 | } |
| 85 | }, |
| 86 | |
| 87 | snapshotSaved(snapshot) { |
| 88 | vitest.snapshot.add(snapshot) |
no test coverage detected