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

Function migrationEntries

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

Source from the content-addressed store, hash-verified

178}
179
180const migrationEntries = (
181 diff: ApiDiff,
182 annotations: ReadonlyMap<string, MigrationAnnotation>,
183 importMapSections: string
184): ReadonlyArray<MigrationEntry> => {
185 const grouped = new Map<string, Array<ApiChange>>()
186 for (const change of diff.changes) {
187 if (change.baseApiId === undefined) {
188 continue
189 }
190 const id = stableApiId(change.baseApiId)
191 const changes = grouped.get(id)
192 if (changes === undefined) {
193 grouped.set(id, [change])
194 } else {
195 changes.push(change)
196 }
197 }
198
199 const entries: Array<MigrationEntry> = []
200 const removedModuleSet = new Set(removedModules(diff))
201 const replacements = importMapReplacements(importMapSections)
202 const addedSignatures = addedApiSignatures(diff)
203 for (const [id, changes] of grouped) {
204 const rename = changes.find((change) => change.classification === "api-renamed")
205 const breaking = changes.some(isBreakingChange)
206 const removed = changes.some((change) => change.classification === "api-removed")
207 const importMove = changes.some((change) => change.classification === "api-moved")
208 if (
209 isUnchangedModuleMove(id, changes, removedModuleSet, replacements, addedSignatures) ||
210 (removed && isRemovalCoveredByModule(id, removedModuleSet, annotations)) ||
211 (!breaking && rename === undefined && !removed) ||
212 (importMove && rename === undefined && !breaking && !annotations.has(id))
213 ) {
214 continue
215 }
216 entries.push({
217 id,
218 module: id.split("#")[0]!,
219 rename
220 })
221 }
222 return entries.sort((left, right) => compareStrings(left.module, right.module) || compareStrings(left.id, right.id))
223}
224
225const renderDetailedEntry = (
226 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
pushMethod · 0.80
someMethod · 0.80
compareStringsFunction · 0.70
getMethod · 0.65
setMethod · 0.65
findMethod · 0.45

Tested by

no test coverage detected