MCPcopy Create free account
hub / github.com/Effect-TS/effect / migrationEntries

Function migrationEntries

packages/tools/api-diff/src/MigrationDoc.ts:188–236  ·  view source on GitHub ↗
(
  diff: ApiDiff,
  annotations: ReadonlyMap<string, MigrationAnnotation>,
  importMapSections: string
)

Source from the content-addressed store, hash-verified

186}
187
188const migrationEntries = (
189 diff: ApiDiff,
190 annotations: ReadonlyMap<string, MigrationAnnotation>,
191 importMapSections: string
192): ReadonlyArray<MigrationEntry> => {
193 const grouped = new Map<string, Array<ApiChange>>()
194 for (const change of diff.changes) {
195 if (change.baseApiId === undefined) {
196 continue
197 }
198 const id = stableApiId(change.baseApiId)
199 const changes = grouped.get(id)
200 if (changes === undefined) {
201 grouped.set(id, [change])
202 } else {
203 changes.push(change)
204 }
205 }
206
207 const entries: Array<MigrationEntry> = []
208 const removedModuleSet = new Set(removedModules(diff))
209 const replacements = importMapReplacements(importMapSections)
210 const addedSignatures = addedApiSignatures(diff)
211 for (const [id, changes] of grouped) {
212 const rename = changes.find((change) => change.classification === "api-renamed")
213 const breaking = changes.some(isBreakingChange)
214 const removed = changes.some((change) => change.classification === "api-removed")
215 const importMove = changes.some((change) => change.classification === "api-moved")
216 if (
217 isUnchangedModuleMove(id, changes, removedModuleSet, replacements, addedSignatures) ||
218 (removed && isRemovalCoveredByModule(id, removedModuleSet, annotations)) ||
219 (!breaking && rename === undefined && !removed) ||
220 (importMove && rename === undefined && !breaking && !annotations.has(id))
221 ) {
222 continue
223 }
224 entries.push({
225 id,
226 module: id.split("#")[0]!,
227 rename
228 })
229 }
230 for (const [id, annotation] of annotations) {
231 if (annotation.include === true && id.includes("#") && !entries.some((entry) => entry.id === id)) {
232 entries.push({ id, module: id.split("#")[0]!, rename: undefined })
233 }
234 }
235 return entries.sort((left, right) => compareStrings(left.module, right.module) || compareStrings(left.id, right.id))
236}
237
238const renderDetailedEntry = (
239 entry: MigrationEntry,

Callers 2

renderMigrationDocumentFunction · 0.85
unannotatedApiIdsFunction · 0.85

Calls 14

stableApiIdFunction · 0.85
removedModulesFunction · 0.85
importMapReplacementsFunction · 0.85
addedApiSignaturesFunction · 0.85
isUnchangedModuleMoveFunction · 0.85
isRemovalCoveredByModuleFunction · 0.85
someMethod · 0.80
compareStringsFunction · 0.70
getMethod · 0.65
setMethod · 0.65
pushMethod · 0.65
findMethod · 0.65

Tested by

no test coverage detected