( context: RollupContext, file: string, code: string, mappings: string | undefined )
| 1017 | }) |
| 1018 | } |
| 1019 | const scanOf = ( |
| 1020 | context: RollupContext, |
| 1021 | file: string, |
| 1022 | code: string, |
| 1023 | mappings: string | undefined |
| 1024 | ): Promise<BundleScan | undefined> | BundleScan | undefined => { |
| 1025 | const build = buildOf(context) |
| 1026 | const pending = pendingScans.get(build) |
| 1027 | if (!pending) return scansByBuild.get(build) |
| 1028 | arrive(pending, file, code) |
| 1029 | if (mappings) pending.mappings.set(file, mappings) |
| 1030 | pending.scanned ??= rollupScanOf( |
| 1031 | context, |
| 1032 | `${++scans}`, |
| 1033 | pending.inputs, |
| 1034 | id => |
| 1035 | transformedFilter.include.test(id) && |
| 1036 | !transformedFilter.exclude.test(id), |
| 1037 | id => arrivalOf(pending, id), |
| 1038 | id => pending.mappings.get(id), |
| 1039 | scanned => |
| 1040 | scanChoosing(bundlerResolveOf(context, isTransformedId), scanned), |
| 1041 | realCwd() |
| 1042 | ) |
| 1043 | .catch( |
| 1044 | (e: unknown): ProgramScan<BundleScan> => ({ |
| 1045 | warnings: [unreadMessageOf(e)] |
| 1046 | }) |
| 1047 | ) |
| 1048 | .then(scan => { |
| 1049 | pending.warnings = scan.warnings |
| 1050 | if (scan.read) scansByBuild.set(build, scan.read) |
| 1051 | return scan.read |
| 1052 | }) |
| 1053 | return pending.scanned |
| 1054 | } |
| 1055 | // a module Rollup's watch mode kept was written for an earlier bundle |
| 1056 | const shouldTransformCachedModule = ({ id }: { id: string }) => |
| 1057 | rewritesCached || |
no test coverage detected