@absolutejs/changelog 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,142 @@
1
1
  // @bun
2
2
  // src/apply.ts
3
+ import ts2 from "typescript";
4
+
5
+ // src/applyMethods.ts
3
6
  import ts from "typescript";
7
+ var IDENTIFIER = /^[A-Za-z_$][\w$]*$/u;
8
+ var PASSES_INSTANCE = new Set(["use", "group", "guard"]);
9
+ var MAX_HOPS = 200;
10
+ var unwrap = (node) => {
11
+ if (ts.isParenthesizedExpression(node) || ts.isAsExpression(node) || ts.isNonNullExpression(node) || ts.isSatisfiesExpression(node) || ts.isAwaitExpression(node))
12
+ return unwrap(node.expression);
13
+ return node;
14
+ };
15
+ var importsOwner = (statement, owner) => ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier) && statement.moduleSpecifier.text === owner.module;
16
+ var bindingsOf = (file, owner) => {
17
+ const binding = { names: new Set, namespaces: new Set, owner };
18
+ const clauses = file.statements.filter((statement) => importsOwner(statement, owner)).map((statement) => statement.importClause?.namedBindings).filter((clause) => clause !== undefined);
19
+ for (const clause of clauses) {
20
+ if (ts.isNamespaceImport(clause))
21
+ binding.namespaces.add(clause.name.text);
22
+ else
23
+ clause.elements.filter((element) => (element.propertyName ?? element.name).text === owner.export).forEach((element) => binding.names.add(element.name.text));
24
+ }
25
+ return binding;
26
+ };
27
+ var halvesOf = (node) => {
28
+ if (ts.isPropertyAccessExpression(node))
29
+ return { left: node.expression, right: node.name };
30
+ if (ts.isQualifiedName(node))
31
+ return { left: node.left, right: node.right };
32
+ return;
33
+ };
34
+ var namesOwner = (node, binding) => {
35
+ if (ts.isIdentifier(node))
36
+ return binding.names.has(node.text);
37
+ const halves = halvesOf(node);
38
+ if (halves === undefined)
39
+ return false;
40
+ const { left, right } = halves;
41
+ return ts.isIdentifier(left) && binding.namespaces.has(left.text) && ts.isIdentifier(right) && right.text === binding.owner.export;
42
+ };
43
+ var typedAsOwner = (type, binding) => type !== undefined && ts.isTypeReferenceNode(type) && namesOwner(type.typeName, binding);
44
+ var parameterFor = (node) => {
45
+ let scope = node.parent;
46
+ while (scope !== undefined) {
47
+ const found = ts.isFunctionLike(scope) ? scope.parameters.find((parameter) => ts.isIdentifier(parameter.name) && parameter.name.text === node.text) : undefined;
48
+ if (found !== undefined)
49
+ return found;
50
+ scope = scope.parent;
51
+ }
52
+ return;
53
+ };
54
+ var handedBy = (parameter) => {
55
+ const handler = parameter.parent;
56
+ if (!ts.isArrowFunction(handler) && !ts.isFunctionExpression(handler))
57
+ return;
58
+ if (handler.parameters[0] !== parameter)
59
+ return;
60
+ const call = handler.parent;
61
+ if (!ts.isCallExpression(call) || !call.arguments.includes(handler))
62
+ return;
63
+ const callee = call.expression;
64
+ return ts.isPropertyAccessExpression(callee) && PASSES_INSTANCE.has(callee.name.text) ? callee.expression : undefined;
65
+ };
66
+ var variablesOf = (file) => {
67
+ const declared = [];
68
+ const collect = (node) => {
69
+ if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name))
70
+ declared.push({ declaration: node, name: node.name.text });
71
+ ts.forEachChild(node, collect);
72
+ };
73
+ collect(file);
74
+ return declared;
75
+ };
76
+ var applyEdits = (source, edits) => [...edits].sort((left, right) => right.start - left.start).reduce((out, edit) => out.slice(0, edit.start) + edit.text + out.slice(edit.end), source);
77
+ var applyMethods = (input) => {
78
+ const { file, methods, source } = input;
79
+ const unchanged = { changed: false, notes: [], source };
80
+ const renameOf = new Map(Object.entries(methods.renames).filter(([before, after]) => IDENTIFIER.test(before) && IDENTIFIER.test(after)));
81
+ if (renameOf.size === 0)
82
+ return unchanged;
83
+ const binding = bindingsOf(file, methods.owner);
84
+ if (binding.names.size === 0 && binding.namespaces.size === 0)
85
+ return unchanged;
86
+ const instances = new Set;
87
+ const step = (node) => {
88
+ if (ts.isNewExpression(node))
89
+ return namesOwner(node.expression, binding);
90
+ if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression))
91
+ return unwrap(node.expression.expression);
92
+ if (!ts.isIdentifier(node))
93
+ return false;
94
+ const parameter = parameterFor(node);
95
+ if (parameter === undefined)
96
+ return instances.has(node.text);
97
+ if (typedAsOwner(parameter.type, binding))
98
+ return true;
99
+ const receiver = handedBy(parameter);
100
+ return receiver === undefined ? false : unwrap(receiver);
101
+ };
102
+ const isInstance = (expression) => {
103
+ let current = unwrap(expression);
104
+ for (let hops = 0;hops < MAX_HOPS; hops += 1) {
105
+ if (typeof current === "boolean")
106
+ return current;
107
+ current = step(current);
108
+ }
109
+ return current === true;
110
+ };
111
+ const variables = variablesOf(file);
112
+ const newlyFound = () => variables.filter(({ declaration, name }) => !instances.has(name) && (typedAsOwner(declaration.type, binding) || declaration.initializer !== undefined && isInstance(declaration.initializer)));
113
+ let found = newlyFound();
114
+ while (found.length > 0) {
115
+ found.forEach(({ name }) => instances.add(name));
116
+ found = newlyFound();
117
+ }
118
+ const edits = [];
119
+ const visit = (node) => {
120
+ if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && renameOf.has(node.expression.name.text) && isInstance(node.expression.expression)) {
121
+ const { name } = node.expression;
122
+ edits.push({
123
+ end: name.getEnd(),
124
+ start: name.getStart(file),
125
+ text: renameOf.get(name.text) ?? name.text
126
+ });
127
+ }
128
+ ts.forEachChild(node, visit);
129
+ };
130
+ visit(file);
131
+ if (edits.length === 0)
132
+ return unchanged;
133
+ const changed = {
134
+ changed: true,
135
+ notes: [],
136
+ source: applyEdits(source, edits)
137
+ };
138
+ return changed;
139
+ };
4
140
 
5
141
  // src/types.ts
6
142
  var CHANGE_KINDS = [
@@ -18,21 +154,22 @@ var CHANGELOG_CONTRACT = 1;
18
154
  var CHANGELOG_FILE = "changelog.json";
19
155
  var CHANGELOG_MARKDOWN = "CHANGELOG.md";
20
156
  var UNRELEASED_DIRECTORY = "changelog/unreleased";
157
+ var isDependencyMigration = (migration) => ("dependencies" in migration);
21
158
  var isDisruptive = (change) => change.kind === "breaking" || change.kind === "removed";
22
159
  var isMechanical = (migration) => !("manual" in migration);
23
160
 
24
161
  // src/apply.ts
25
- var IDENTIFIER = /^[A-Za-z_$][\w$]*$/u;
162
+ var IDENTIFIER2 = /^[A-Za-z_$][\w$]*$/u;
26
163
  var SPECIFIER = /^[@a-zA-Z0-9._~-][a-zA-Z0-9._~/-]*$/u;
27
- var applyEdits = (source, edits) => [...edits].sort((left, right) => right.start - left.start).reduce((out, edit) => out.slice(0, edit.start) + edit.text + out.slice(edit.end), source);
28
- var kindOf = (path) => /\.[cm]?ts$/u.test(path) ? ts.ScriptKind.TS : ts.ScriptKind.TSX;
29
- var parse = (source, path) => ts.createSourceFile(path, source, ts.ScriptTarget.Latest, true, kindOf(path));
164
+ var applyEdits2 = (source, edits) => [...edits].sort((left, right) => right.start - left.start).reduce((out, edit) => out.slice(0, edit.start) + edit.text + out.slice(edit.end), source);
165
+ var kindOf = (path) => /\.[cm]?ts$/u.test(path) ? ts2.ScriptKind.TS : ts2.ScriptKind.TSX;
166
+ var parse = (source, path) => ts2.createSourceFile(path, source, ts2.ScriptTarget.Latest, true, kindOf(path));
30
167
  var belongsTo = (specifier, name) => specifier === name || specifier.startsWith(`${name}/`);
31
- var moduleTextOf = (statement) => statement.moduleSpecifier !== undefined && ts.isStringLiteral(statement.moduleSpecifier) ? statement.moduleSpecifier.text : undefined;
168
+ var moduleTextOf = (statement) => statement.moduleSpecifier !== undefined && ts2.isStringLiteral(statement.moduleSpecifier) ? statement.moduleSpecifier.text : undefined;
32
169
  var portsOf = (file) => {
33
170
  const found = [];
34
171
  for (const statement of file.statements) {
35
- if (!ts.isImportDeclaration(statement) && !ts.isExportDeclaration(statement))
172
+ if (!ts2.isImportDeclaration(statement) && !ts2.isExportDeclaration(statement))
36
173
  continue;
37
174
  const module = moduleTextOf(statement);
38
175
  if (module !== undefined)
@@ -41,10 +178,10 @@ var portsOf = (file) => {
41
178
  return found;
42
179
  };
43
180
  var namedElementsOf = (statement) => {
44
- const clause = ts.isImportDeclaration(statement) ? statement.importClause?.namedBindings : statement.exportClause;
181
+ const clause = ts2.isImportDeclaration(statement) ? statement.importClause?.namedBindings : statement.exportClause;
45
182
  if (clause === undefined)
46
183
  return;
47
- if (ts.isNamedImports(clause) || ts.isNamedExports(clause))
184
+ if (ts2.isNamedImports(clause) || ts2.isNamedExports(clause))
48
185
  return clause;
49
186
  return;
50
187
  };
@@ -54,46 +191,46 @@ var declaresLocally = (file, name) => {
54
191
  const visit = (node) => {
55
192
  if (found)
56
193
  return;
57
- const declares = (ts.isVariableDeclaration(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node) || ts.isEnumDeclaration(node) || ts.isParameter(node) || ts.isBindingElement(node)) && node.name !== undefined && ts.isIdentifier(node.name) && node.name.text === name;
194
+ const declares = (ts2.isVariableDeclaration(node) || ts2.isFunctionDeclaration(node) || ts2.isClassDeclaration(node) || ts2.isInterfaceDeclaration(node) || ts2.isTypeAliasDeclaration(node) || ts2.isEnumDeclaration(node) || ts2.isParameter(node) || ts2.isBindingElement(node)) && node.name !== undefined && ts2.isIdentifier(node.name) && node.name.text === name;
58
195
  if (declares)
59
196
  found = true;
60
197
  else
61
- ts.forEachChild(node, visit);
198
+ ts2.forEachChild(node, visit);
62
199
  };
63
- ts.forEachChild(file, visit);
200
+ ts2.forEachChild(file, visit);
64
201
  return found;
65
202
  };
66
203
  var isReference = (node) => {
67
204
  const { parent } = node;
68
205
  if (parent === undefined)
69
206
  return false;
70
- if (ts.isPropertyAccessExpression(parent) && parent.name === node)
207
+ if (ts2.isPropertyAccessExpression(parent) && parent.name === node)
71
208
  return false;
72
- if (ts.isQualifiedName(parent) && parent.right === node)
209
+ if (ts2.isQualifiedName(parent) && parent.right === node)
73
210
  return false;
74
- if (ts.isPropertyAssignment(parent) && parent.name === node)
211
+ if (ts2.isPropertyAssignment(parent) && parent.name === node)
75
212
  return false;
76
- if (ts.isBindingElement(parent) && parent.propertyName === node)
213
+ if (ts2.isBindingElement(parent) && parent.propertyName === node)
77
214
  return false;
78
- if (ts.isJsxAttribute(parent) && parent.name === node)
215
+ if (ts2.isJsxAttribute(parent) && parent.name === node)
79
216
  return false;
80
- if ((ts.isMethodDeclaration(parent) || ts.isPropertyDeclaration(parent) || ts.isPropertySignature(parent) || ts.isMethodSignature(parent) || ts.isEnumMember(parent)) && parent.name === node)
217
+ if ((ts2.isMethodDeclaration(parent) || ts2.isPropertyDeclaration(parent) || ts2.isPropertySignature(parent) || ts2.isMethodSignature(parent) || ts2.isEnumMember(parent)) && parent.name === node)
81
218
  return false;
82
- if ((ts.isImportSpecifier(parent) || ts.isExportSpecifier(parent) || ts.isImportClause(parent) || ts.isNamespaceImport(parent)) && true)
219
+ if ((ts2.isImportSpecifier(parent) || ts2.isExportSpecifier(parent) || ts2.isImportClause(parent) || ts2.isNamespaceImport(parent)) && true)
83
220
  return false;
84
- return !ts.isDeclarationStatement(parent);
221
+ return !ts2.isDeclarationStatement(parent);
85
222
  };
86
223
  var referencesTo = (file, name) => {
87
224
  const found = [];
88
225
  const shorthand = [];
89
226
  const visit = (node) => {
90
- if (ts.isShorthandPropertyAssignment(node) && node.name.text === name)
227
+ if (ts2.isShorthandPropertyAssignment(node) && node.name.text === name)
91
228
  shorthand.push(node);
92
- else if (ts.isIdentifier(node) && node.text === name && isReference(node))
229
+ else if (ts2.isIdentifier(node) && node.text === name && isReference(node))
93
230
  found.push(node);
94
- ts.forEachChild(node, visit);
231
+ ts2.forEachChild(node, visit);
95
232
  };
96
- ts.forEachChild(file, visit);
233
+ ts2.forEachChild(file, visit);
97
234
  return { references: found, shorthand };
98
235
  };
99
236
  var withoutElement = (elements, dropped, file) => {
@@ -103,7 +240,7 @@ var withoutElement = (elements, dropped, file) => {
103
240
  var isTypeOnly = (statement, element) => {
104
241
  if (element.isTypeOnly)
105
242
  return true;
106
- return ts.isImportDeclaration(statement) ? statement.importClause?.isTypeOnly === true : statement.isTypeOnly;
243
+ return ts2.isImportDeclaration(statement) ? statement.importClause?.isTypeOnly === true : statement.isTypeOnly;
107
244
  };
108
245
  var quoteOf = (statement, file) => statement.moduleSpecifier?.getText(file).startsWith('"') === true ? '"' : "'";
109
246
  var renameTargetsIn = (input) => portsOf(input.file).filter(({ module }) => belongsTo(module, input.packageName)).flatMap(({ statement }) => {
@@ -157,7 +294,7 @@ var renameOneImport = (input) => {
157
294
  };
158
295
  var applyRename = (input) => {
159
296
  const { file, packageName, rename, source } = input;
160
- if (!IDENTIFIER.test(rename.to))
297
+ if (!IDENTIFIER2.test(rename.to))
161
298
  return {
162
299
  changed: false,
163
300
  notes: [`\`${rename.to}\` is not a name, so this rename was not applied`],
@@ -185,7 +322,7 @@ var applyRename = (input) => {
185
322
  return {
186
323
  changed: true,
187
324
  notes: done.flatMap((one) => ("note" in one) && one.note ? [one.note] : []),
188
- source: applyEdits(source, edits)
325
+ source: applyEdits2(source, edits)
189
326
  };
190
327
  };
191
328
  var applyMoved = (input) => {
@@ -210,7 +347,7 @@ var applyMoved = (input) => {
210
347
  continue;
211
348
  const quote = quoteOf(statement, file);
212
349
  const kept = withoutElement(clause.elements, element, file);
213
- const carriesDefault = ts.isImportDeclaration(statement) && (statement.importClause?.name !== undefined || statement.importClause?.isTypeOnly === true);
350
+ const carriesDefault = ts2.isImportDeclaration(statement) && (statement.importClause?.name !== undefined || statement.importClause?.isTypeOnly === true);
214
351
  const whole = kept === undefined && !carriesDefault && statement.moduleSpecifier;
215
352
  if (whole)
216
353
  edits.push({
@@ -220,10 +357,10 @@ var applyMoved = (input) => {
220
357
  });
221
358
  if (whole)
222
359
  continue;
223
- const keyword = ts.isExportDeclaration(statement) ? "export" : "import";
360
+ const keyword = ts2.isExportDeclaration(statement) ? "export" : "import";
224
361
  const typed = isTypeOnly(statement, element) ? "type " : "";
225
362
  const carried = element.propertyName ? `${moved.symbol} as ${element.name.text}` : element.name.text;
226
- const carrier = ts.isImportDeclaration(statement) && statement.importClause?.name;
363
+ const carrier = ts2.isImportDeclaration(statement) && statement.importClause?.name;
227
364
  const emptied = kept === undefined && carrier ? { end: clause.getEnd(), start: carrier.getEnd(), text: "" } : undefined;
228
365
  const trimmed = kept === undefined ? undefined : {
229
366
  end: clause.getEnd() - 1,
@@ -240,7 +377,7 @@ ${keyword} ${typed}{ ${carried} } from ${quote}${moved.to}${quote};`
240
377
  }
241
378
  if (edits.length === 0)
242
379
  return { changed: false, notes: [], source };
243
- return { changed: true, notes: [], source: applyEdits(source, edits) };
380
+ return { changed: true, notes: [], source: applyEdits2(source, edits) };
244
381
  };
245
382
  var applyResubpath = (input) => {
246
383
  const { file, resubpath, source } = input;
@@ -265,7 +402,7 @@ var applyResubpath = (input) => {
265
402
  }
266
403
  if (edits.length === 0)
267
404
  return { changed: false, notes: [], source };
268
- return { changed: true, notes: [], source: applyEdits(source, edits) };
405
+ return { changed: true, notes: [], source: applyEdits2(source, edits) };
269
406
  };
270
407
  var applyMigration = (source, input) => {
271
408
  const { migration, packageName } = input;
@@ -281,6 +418,10 @@ var applyMigration = (source, input) => {
281
418
  });
282
419
  if ("resubpath" in migration)
283
420
  return applyResubpath({ file, resubpath: migration.resubpath, source });
421
+ if ("methods" in migration)
422
+ return applyMethods({ file, methods: migration.methods, source });
423
+ if ("dependencies" in migration)
424
+ return { changed: false, notes: [], source };
284
425
  return applyMoved({ file, moved: migration.moved, source });
285
426
  };
286
427
  var applyMigrations = (source, input) => input.migrations.reduce((carried, migration) => {
@@ -295,6 +436,65 @@ var applyMigrations = (source, input) => input.migrations.reduce((carried, migra
295
436
  source: result.source
296
437
  };
297
438
  }, { changed: false, notes: [], source });
439
+ // src/applyDependencies.ts
440
+ var SECTIONS = [
441
+ "dependencies",
442
+ "devDependencies",
443
+ "peerDependencies",
444
+ "optionalDependencies"
445
+ ];
446
+ var RANGE = /^[\w.^~<>=*| -]+$/u;
447
+ var VERSIONED = /^[\^~<>=]*\s*v?\d/u;
448
+ var SCOPE_WILDCARD = "/*";
449
+ var isTable = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
450
+ var matches = (pattern, name) => pattern.endsWith(SCOPE_WILDCARD) ? name.startsWith(pattern.slice(0, pattern.length - 1)) : pattern === name;
451
+ var floorOf = (spec) => spec.trim().replace(/^[\^~<>=v\s]+/u, "").split(/[\s|]/u)[0] ?? "";
452
+ var satisfies = (version, range) => {
453
+ try {
454
+ return Bun.semver.satisfies(version, range);
455
+ } catch {
456
+ return false;
457
+ }
458
+ };
459
+ var indentOf = (text) => /\n([ \t]+)"/u.exec(text)?.[1] ?? " ";
460
+ var moves = (migration, name, spec) => {
461
+ const { names, range } = migration.dependencies;
462
+ return typeof spec === "string" && VERSIONED.test(spec) && names.some((pattern) => matches(pattern, name)) && spec !== range && !satisfies(floorOf(spec), range);
463
+ };
464
+ var moveSection = (table, section, migration) => {
465
+ const { range } = migration.dependencies;
466
+ const edits = [];
467
+ for (const [name, spec] of Object.entries(table)) {
468
+ if (!moves(migration, name, spec))
469
+ continue;
470
+ table[name] = range;
471
+ edits.push({ from: spec, name, section, to: range });
472
+ }
473
+ return edits;
474
+ };
475
+ var applyDependencyMigrations = (manifest, migrations) => {
476
+ const unchanged = { edits: [], manifest };
477
+ const wanted = migrations.filter(isDependencyMigration).filter((migration) => RANGE.test(migration.dependencies.range));
478
+ if (wanted.length === 0)
479
+ return unchanged;
480
+ const document = JSON.parse(manifest);
481
+ if (!isTable(document))
482
+ return unchanged;
483
+ const edits = wanted.flatMap((migration) => SECTIONS.flatMap((section) => {
484
+ const table = document[section];
485
+ return isTable(table) ? moveSection(table, section, migration) : [];
486
+ }));
487
+ if (edits.length === 0)
488
+ return unchanged;
489
+ const trailing = manifest.endsWith(`
490
+ `) ? `
491
+ ` : "";
492
+ const moved = {
493
+ edits,
494
+ manifest: JSON.stringify(document, null, indentOf(manifest)) + trailing
495
+ };
496
+ return moved;
497
+ };
298
498
  // src/authoring.ts
299
499
  var change = (entry) => entry;
300
500
  var manual = (instruction) => ({
@@ -430,11 +630,11 @@ var readMigration = (value, where, problems) => {
430
630
  instruction,
431
631
  rename: { from: rename.from, to: rename.to }
432
632
  };
433
- const { moved: moved2 } = value;
434
- if (isRecord(moved2) && isText(moved2.symbol) && isText(moved2.from) && isText(moved2.to))
633
+ const { moved } = value;
634
+ if (isRecord(moved) && isText(moved.symbol) && isText(moved.from) && isText(moved.to))
435
635
  return {
436
636
  instruction,
437
- moved: { from: moved2.from, symbol: moved2.symbol, to: moved2.to }
637
+ moved: { from: moved.from, symbol: moved.symbol, to: moved.to }
438
638
  };
439
639
  const { resubpath } = value;
440
640
  if (isRecord(resubpath) && isText(resubpath.from) && isText(resubpath.to))
@@ -442,9 +642,27 @@ var readMigration = (value, where, problems) => {
442
642
  instruction,
443
643
  resubpath: { from: resubpath.from, to: resubpath.to }
444
644
  };
645
+ const { methods } = value;
646
+ if (isRecord(methods) && isRecord(methods.owner) && isText(methods.owner.module) && isText(methods.owner.export) && isRecord(methods.renames) && Object.keys(methods.renames).length > 0 && Object.values(methods.renames).every(isText))
647
+ return {
648
+ instruction,
649
+ methods: {
650
+ owner: { export: methods.owner.export, module: methods.owner.module },
651
+ renames: Object.fromEntries(Object.entries(methods.renames).filter((entry) => isText(entry[1])))
652
+ }
653
+ };
654
+ const { dependencies } = value;
655
+ if (isRecord(dependencies) && isText(dependencies.range) && Array.isArray(dependencies.names) && dependencies.names.length > 0 && dependencies.names.every(isText)) {
656
+ const [first, ...rest] = dependencies.names.filter((name) => isText(name));
657
+ if (first !== undefined)
658
+ return {
659
+ dependencies: { names: [first, ...rest], range: dependencies.range },
660
+ instruction
661
+ };
662
+ }
445
663
  if (value.manual === true)
446
664
  return { instruction, manual: true };
447
- problems.push(`${where}: migration says neither rename, moved, resubpath nor manual`);
665
+ problems.push(`${where}: migration says neither rename, moved, resubpath, methods, dependencies nor manual`);
448
666
  return;
449
667
  };
450
668
  var readChange = (value, where, problems) => {
@@ -527,12 +745,12 @@ var readRelease = (value, where, problems) => {
527
745
  };
528
746
  var validateChange = (value, where = "entry") => {
529
747
  const problems = [];
530
- const change2 = readChange(value, where, problems);
531
- if (change2 === undefined) {
748
+ const change = readChange(value, where, problems);
749
+ if (change === undefined) {
532
750
  const failed = { problems };
533
751
  return failed;
534
752
  }
535
- const read = { change: change2 };
753
+ const read = { change };
536
754
  return read;
537
755
  };
538
756
  var parseChangelog = (value) => {
@@ -558,26 +776,26 @@ var parseChangelog = (value) => {
558
776
  };
559
777
  };
560
778
  var releasesBetween = (changelog, from, upto) => [...changelog.releases].filter((release) => compareVersions(release.version, from) > 0 && compareVersions(release.version, upto) <= 0).sort((left, right) => compareVersions(left.version, right.version));
561
- var changesBetween = (changelog, from, upto) => releasesBetween(changelog, from, upto).flatMap((release) => release.changes.map((change2) => {
562
- const found = { change: change2, version: release.version };
779
+ var changesBetween = (changelog, from, upto) => releasesBetween(changelog, from, upto).flatMap((release) => release.changes.map((change) => {
780
+ const found = { change, version: release.version };
563
781
  return found;
564
782
  }));
565
783
  var isDisruptiveAt = (found) => isDisruptive(found.change);
566
784
  var disruptiveBetween = (changelog, from, upto) => changesBetween(changelog, from, upto).filter(isDisruptiveAt);
567
785
  var mechanicalMigrations = (migrations) => migrations.filter((found) => isMechanical(found.migration));
568
- var migrationsBetween = (changelog, from, upto) => disruptiveBetween(changelog, from, upto).map(({ change: change2, version }) => {
786
+ var migrationsBetween = (changelog, from, upto) => disruptiveBetween(changelog, from, upto).map(({ change, version }) => {
569
787
  const found = {
570
- migration: change2.migration,
571
- symbols: change2.symbols,
788
+ migration: change.migration,
789
+ symbols: change.symbols,
572
790
  version
573
791
  };
574
792
  return found;
575
793
  });
576
- var symbolsDisturbedBetween = (changelog, from, upto) => new Set(disruptiveBetween(changelog, from, upto).flatMap(({ change: change2 }) => change2.symbols));
794
+ var symbolsDisturbedBetween = (changelog, from, upto) => new Set(disruptiveBetween(changelog, from, upto).flatMap(({ change }) => change.symbols));
577
795
 
578
796
  // src/surface.ts
579
797
  import path from "path";
580
- import ts2 from "typescript";
798
+ import ts3 from "typescript";
581
799
 
582
800
  // src/tarball.ts
583
801
  var TAR_BLOCK = 512;
@@ -632,8 +850,40 @@ var readTar = (archive, keep, limits = {}) => {
632
850
 
633
851
  // src/surface.ts
634
852
  var DECLARATION = /\.d\.[cm]?ts$/u;
635
- var parse2 = (source, name) => ts2.createSourceFile(name, source, ts2.ScriptTarget.Latest, true, ts2.ScriptKind.TS);
853
+ var parse2 = (source, name) => ts3.createSourceFile(name, source, ts3.ScriptTarget.Latest, true, ts3.ScriptKind.TS);
636
854
  var normalize = (text) => text.replace(/\s+/gu, " ").trim();
855
+ var CLOSERS = new Set(["}", ")", "]", ">"]);
856
+ var wordy = (token) => /^[\w$#@]/u.test(token) || /[\w$]$/u.test(token);
857
+ var LAST2 = -1;
858
+ var tokenText = (scanner, scanned, state) => {
859
+ const closesTemplate = scanned === ts3.SyntaxKind.CloseBraceToken && state.templates.at(LAST2) === state.depth;
860
+ const token = closesTemplate ? scanner.reScanTemplateToken(false) : scanned;
861
+ if (closesTemplate && token === ts3.SyntaxKind.TemplateTail)
862
+ state.templates.pop();
863
+ if (closesTemplate)
864
+ return scanner.getTokenText();
865
+ if (token === ts3.SyntaxKind.StringLiteral)
866
+ return JSON.stringify(scanner.getTokenValue());
867
+ if (token === ts3.SyntaxKind.TemplateHead)
868
+ state.templates.push(state.depth);
869
+ if (token === ts3.SyntaxKind.OpenBraceToken)
870
+ state.depth += 1;
871
+ if (token === ts3.SyntaxKind.CloseBraceToken)
872
+ state.depth -= 1;
873
+ return scanner.getTokenText();
874
+ };
875
+ var canonical = (text) => {
876
+ const scanner = ts3.createScanner(ts3.ScriptTarget.Latest, true, ts3.LanguageVariant.Standard, text);
877
+ const state = { depth: 0, templates: [] };
878
+ const tokens = [];
879
+ for (let token = scanner.scan();token !== ts3.SyntaxKind.EndOfFileToken; token = scanner.scan()) {
880
+ const value = tokenText(scanner, token, state);
881
+ if (CLOSERS.has(value) && tokens.at(LAST2) === ",")
882
+ tokens.pop();
883
+ tokens.push(value);
884
+ }
885
+ return tokens.reduce((joined, token, index) => index > 0 && wordy(tokens[index - 1] ?? "") && wordy(token) ? `${joined} ${token}` : `${joined}${token}`, "");
886
+ };
637
887
  var resolveFrom = (files, from, specifier) => {
638
888
  if (!specifier.startsWith("."))
639
889
  return;
@@ -650,12 +900,12 @@ var resolveFrom = (files, from, specifier) => {
650
900
  return candidates.find((candidate) => files.has(candidate));
651
901
  };
652
902
  var declaredNameOf = (statement) => {
653
- if (ts2.isFunctionDeclaration(statement) || ts2.isClassDeclaration(statement) || ts2.isInterfaceDeclaration(statement) || ts2.isTypeAliasDeclaration(statement) || ts2.isEnumDeclaration(statement) || ts2.isModuleDeclaration(statement))
654
- return statement.name !== undefined && ts2.isIdentifier(statement.name) ? statement.name.text : undefined;
903
+ if (ts3.isFunctionDeclaration(statement) || ts3.isClassDeclaration(statement) || ts3.isInterfaceDeclaration(statement) || ts3.isTypeAliasDeclaration(statement) || ts3.isEnumDeclaration(statement) || ts3.isModuleDeclaration(statement))
904
+ return statement.name !== undefined && ts3.isIdentifier(statement.name) ? statement.name.text : undefined;
655
905
  return;
656
906
  };
657
- var isExported = (statement) => ts2.canHaveModifiers(statement) && ts2.getModifiers(statement)?.some((modifier) => modifier.kind === ts2.SyntaxKind.ExportKeyword) === true;
658
- var variableNamesOf = (statement) => statement.declarationList.declarations.map((declaration) => declaration.name).filter((name) => ts2.isIdentifier(name)).map((name) => name.text);
907
+ var isExported = (statement) => ts3.canHaveModifiers(statement) && ts3.getModifiers(statement)?.some((modifier) => modifier.kind === ts3.SyntaxKind.ExportKeyword) === true;
908
+ var variableNamesOf = (statement) => statement.declarationList.declarations.map((declaration) => declaration.name).filter((name) => ts3.isIdentifier(name)).map((name) => name.text);
659
909
  var declarationsIn = (file) => {
660
910
  const found = new Map;
661
911
  for (const statement of file.statements) {
@@ -663,7 +913,7 @@ var declarationsIn = (file) => {
663
913
  const named = declaredNameOf(statement);
664
914
  if (named !== undefined)
665
915
  found.set(named, text);
666
- if (!ts2.isVariableStatement(statement))
916
+ if (!ts3.isVariableStatement(statement))
667
917
  continue;
668
918
  for (const name of variableNamesOf(statement))
669
919
  found.set(name, text);
@@ -683,7 +933,7 @@ var declaresTypes = (manifest) => {
683
933
  var contributionOf = (input) => {
684
934
  const { file, files, from, local, seen, statement } = input;
685
935
  const nothing = [];
686
- if (ts2.isExportAssignment(statement))
936
+ if (ts3.isExportAssignment(statement))
687
937
  return [
688
938
  [
689
939
  statement.isExportEquals === true ? "export=" : "default",
@@ -695,19 +945,19 @@ var contributionOf = (input) => {
695
945
  return [
696
946
  [named, local.get(named) ?? normalize(statement.getText(file))]
697
947
  ];
698
- if (ts2.isVariableStatement(statement) && isExported(statement)) {
948
+ if (ts3.isVariableStatement(statement) && isExported(statement)) {
699
949
  const text = normalize(statement.getText(file));
700
950
  return variableNamesOf(statement).map((name) => [name, text]);
701
951
  }
702
- if (!ts2.isExportDeclaration(statement))
952
+ if (!ts3.isExportDeclaration(statement))
703
953
  return nothing;
704
- const specifier = statement.moduleSpecifier !== undefined && ts2.isStringLiteral(statement.moduleSpecifier) ? statement.moduleSpecifier.text : undefined;
954
+ const specifier = statement.moduleSpecifier !== undefined && ts3.isStringLiteral(statement.moduleSpecifier) ? statement.moduleSpecifier.text : undefined;
705
955
  const target = specifier === undefined ? undefined : resolveFrom(files, from, specifier);
706
956
  const theirs = target === undefined ? new Map : exportsOf(files, target, new Set(seen));
707
957
  const clause = statement.exportClause;
708
958
  if (clause === undefined)
709
959
  return [...theirs].filter(([name]) => name !== "default" && name !== "export=");
710
- if (ts2.isNamespaceExport(clause))
960
+ if (ts3.isNamespaceExport(clause))
711
961
  return [[clause.name.text, `export * as ${clause.name.text}`]];
712
962
  return clause.elements.map((element) => {
713
963
  const sourceName = (element.propertyName ?? element.name).text;
@@ -799,7 +1049,7 @@ var SHAPE = {
799
1049
  types: "types",
800
1050
  unknown: "unknown"
801
1051
  };
802
- var isStub = (declaration) => declaration.startsWith("export {");
1052
+ var isStub = (declaration) => /^export\s*\{/u.test(declaration);
803
1053
  var signatureOf = (declaration) => {
804
1054
  const file = parse2(`${declaration}
805
1055
  `, "declaration.d.ts");
@@ -814,9 +1064,9 @@ var parametersOf = (declaration) => {
814
1064
  return "";
815
1065
  const found = [];
816
1066
  const visit = (node) => {
817
- if (ts2.isFunctionTypeNode(node) || ts2.isFunctionDeclaration(node) || ts2.isMethodSignature(node) || ts2.isMethodDeclaration(node) || ts2.isConstructSignatureDeclaration(node) || ts2.isConstructorDeclaration(node))
818
- found.push(node.parameters.map((parameter) => normalize(parameter.getText())).join(", "));
819
- ts2.forEachChild(node, visit);
1067
+ if (ts3.isFunctionTypeNode(node) || ts3.isFunctionDeclaration(node) || ts3.isMethodSignature(node) || ts3.isMethodDeclaration(node) || ts3.isConstructSignatureDeclaration(node) || ts3.isConstructorDeclaration(node))
1068
+ found.push(node.parameters.map((parameter) => canonical(parameter.getText())).join(", "));
1069
+ ts3.forEachChild(node, visit);
820
1070
  };
821
1071
  visit(statement);
822
1072
  return found.join(" | ");
@@ -827,20 +1077,20 @@ var membersOf = (declaration) => {
827
1077
  if (statement === undefined)
828
1078
  return members;
829
1079
  const visit = (node) => {
830
- if ((ts2.isPropertySignature(node) || ts2.isMethodSignature(node) || ts2.isPropertyDeclaration(node) || ts2.isMethodDeclaration(node) || ts2.isEnumMember(node)) && node.name !== undefined && (ts2.isIdentifier(node.name) || ts2.isStringLiteral(node.name)))
1080
+ if ((ts3.isPropertySignature(node) || ts3.isMethodSignature(node) || ts3.isPropertyDeclaration(node) || ts3.isMethodDeclaration(node) || ts3.isEnumMember(node)) && node.name !== undefined && (ts3.isIdentifier(node.name) || ts3.isStringLiteral(node.name)))
831
1081
  members.add(node.name.text);
832
- ts2.forEachChild(node, visit);
1082
+ ts3.forEachChild(node, visit);
833
1083
  };
834
1084
  visit(statement);
835
1085
  return members;
836
1086
  };
837
1087
  var sameNames = (left, right) => left.size === right.size && [...left].every((name) => right.has(name));
838
- var changeShape = (change2) => {
839
- if (isStub(change2.before) !== isStub(change2.after))
1088
+ var changeShape = (change) => {
1089
+ if (isStub(change.before) !== isStub(change.after))
840
1090
  return SHAPE.unknown;
841
- if (parametersOf(change2.before) !== parametersOf(change2.after))
1091
+ if (parametersOf(change.before) !== parametersOf(change.after))
842
1092
  return SHAPE.parameters;
843
- if (!sameNames(membersOf(change2.before), membersOf(change2.after)))
1093
+ if (!sameNames(membersOf(change.before), membersOf(change.after)))
844
1094
  return SHAPE.members;
845
1095
  return SHAPE.types;
846
1096
  };
@@ -857,7 +1107,7 @@ var diffSurface = (before, after) => {
857
1107
  const lost = was.entries.filter((entry) => !now.entries.includes(entry));
858
1108
  if (lost.length > 0)
859
1109
  withdrawn.push({ from: lost, name });
860
- if (now.declaration !== was.declaration)
1110
+ if (canonical(now.declaration) !== canonical(was.declaration))
861
1111
  changed.push({
862
1112
  after: now.declaration,
863
1113
  before: was.declaration,
@@ -875,12 +1125,12 @@ var diffSurface = (before, after) => {
875
1125
  withdrawn
876
1126
  };
877
1127
  };
878
- var notable = (diff) => diff.changed.filter((change2) => change2.shape === "parameters" || change2.shape === "members");
1128
+ var notable = (diff) => diff.changed.filter((change) => change.shape === "parameters" || change.shape === "members");
879
1129
 
880
1130
  // src/entries.ts
881
- var loadEntry = async (path2) => {
1131
+ var loadEntry = async (path) => {
882
1132
  try {
883
- const module = await import(pathToFileURL(path2).href);
1133
+ const module = await import(pathToFileURL(path).href);
884
1134
  const named = typeof module === "object" && module !== null && "change" in module ? module.change : undefined;
885
1135
  const exported = named ?? (typeof module === "object" && module !== null && "default" in module ? module.default : undefined);
886
1136
  const read = { exported };
@@ -898,10 +1148,10 @@ var OUTPUT_DIRECTORIES = ["dist", "build", "lib", "types", "out"];
898
1148
  var newestUnder = async (root) => {
899
1149
  const found = await readdir(root, { withFileTypes: true }).catch(() => []);
900
1150
  const times = await Promise.all(found.map(async (entry) => {
901
- const path2 = join(root, entry.name);
1151
+ const path = join(root, entry.name);
902
1152
  if (entry.isDirectory())
903
- return newestUnder(path2);
904
- return stat(path2).then((stats) => stats.mtimeMs, () => 0);
1153
+ return newestUnder(path);
1154
+ return stat(path).then((stats) => stats.mtimeMs, () => 0);
905
1155
  }));
906
1156
  return Math.max(0, ...times);
907
1157
  };
@@ -957,8 +1207,8 @@ var loadUnreleased = async (packageRoot) => {
957
1207
  }
958
1208
  return { entries, problems };
959
1209
  };
960
- var readJsonFile = async (path2) => {
961
- const source = await readFile(path2, "utf8").catch(() => {
1210
+ var readJsonFile = async (path) => {
1211
+ const source = await readFile(path, "utf8").catch(() => {
962
1212
  return;
963
1213
  });
964
1214
  if (source === undefined)
@@ -976,39 +1226,39 @@ var strayEntries = async (packageRoot) => {
976
1226
  };
977
1227
  // src/reconcile.ts
978
1228
  var migrationHolds = (input) => {
979
- const { after, change: change2, subpaths } = input;
1229
+ const { after, change, subpaths } = input;
980
1230
  const wrong = [];
981
- const { migration } = change2;
1231
+ const { migration } = change;
982
1232
  if ("rename" in migration) {
983
1233
  const { from } = migration.rename;
984
1234
  const into = migration.rename.to;
985
1235
  if (!after.has(into))
986
- wrong.push(`\`${change2.summary}\` renames to \`${into}\`, which this version does not export`);
1236
+ wrong.push(`\`${change.summary}\` renames to \`${into}\`, which this version does not export`);
987
1237
  if (after.has(from))
988
- wrong.push(`\`${change2.summary}\` renames \`${from}\` away, but this version still exports it`);
989
- if (!change2.symbols.includes(from))
990
- wrong.push(`\`${change2.summary}\` renames \`${from}\`, which is not in its own symbols`);
1238
+ wrong.push(`\`${change.summary}\` renames \`${from}\` away, but this version still exports it`);
1239
+ if (!change.symbols.includes(from))
1240
+ wrong.push(`\`${change.summary}\` renames \`${from}\`, which is not in its own symbols`);
991
1241
  }
992
1242
  if ("moved" in migration) {
993
1243
  const { symbol } = migration.moved;
994
1244
  const into = migration.moved.to;
995
1245
  if (!after.has(symbol))
996
- wrong.push(`\`${change2.summary}\` moves \`${symbol}\`, which this version does not export`);
1246
+ wrong.push(`\`${change.summary}\` moves \`${symbol}\`, which this version does not export`);
997
1247
  if (subpaths.size > 0 && !subpaths.has(into))
998
- wrong.push(`\`${change2.summary}\` moves \`${symbol}\` to \`${into}\`, which is not an entry point of this package`);
1248
+ wrong.push(`\`${change.summary}\` moves \`${symbol}\` to \`${into}\`, which is not an entry point of this package`);
999
1249
  }
1000
1250
  if ("resubpath" in migration && subpaths.size > 0 && !subpaths.has(migration.resubpath.to))
1001
- wrong.push(`\`${change2.summary}\` points at \`${migration.resubpath.to}\`, which is not an entry point of this package`);
1002
- if (change2.kind === "removed") {
1003
- for (const symbol of change2.symbols)
1251
+ wrong.push(`\`${change.summary}\` points at \`${migration.resubpath.to}\`, which is not an entry point of this package`);
1252
+ if (change.kind === "removed") {
1253
+ for (const symbol of change.symbols)
1004
1254
  if (after.has(symbol))
1005
- wrong.push(`\`${change2.summary}\` says \`${symbol}\` was removed, but this version still exports it`);
1255
+ wrong.push(`\`${change.summary}\` says \`${symbol}\` was removed, but this version still exports it`);
1006
1256
  }
1007
1257
  return wrong;
1008
1258
  };
1009
1259
  var describeReconciliation = (found) => {
1010
1260
  const lines = [];
1011
- const moved2 = {
1261
+ const moved = {
1012
1262
  members: "changed the members of its type",
1013
1263
  parameters: "changed what it is called with",
1014
1264
  removed: "is no longer exported",
@@ -1016,27 +1266,27 @@ var describeReconciliation = (found) => {
1016
1266
  withdrawn: "is no longer exported from"
1017
1267
  };
1018
1268
  for (const entry of found.unannounced)
1019
- lines.push(entry.kind === "withdrawn" ? `\`${entry.name}\` ${moved2.withdrawn} ${(entry.from ?? []).join(", ")} and no entry says so` : `\`${entry.name}\` ${moved2[entry.kind]} and no entry says so`);
1269
+ lines.push(entry.kind === "withdrawn" ? `\`${entry.name}\` ${moved.withdrawn} ${(entry.from ?? []).join(", ")} and no entry says so` : `\`${entry.name}\` ${moved[entry.kind]} and no entry says so`);
1020
1270
  for (const name of found.unknownSymbols)
1021
1271
  lines.push(`an entry names \`${name}\`, which this package does not export`);
1022
1272
  lines.push(...found.wrongMigrations);
1023
1273
  return lines;
1024
1274
  };
1025
1275
  var reconcile = (input) => {
1026
- const disruptive = new Set(input.changes.filter(isDisruptive).flatMap((change2) => [...change2.symbols]));
1027
- const mentioned = new Set(input.changes.flatMap((change2) => [...change2.symbols ?? []]));
1276
+ const disruptive = new Set(input.changes.filter(isDisruptive).flatMap((change) => [...change.symbols]));
1277
+ const mentioned = new Set(input.changes.flatMap((change) => [...change.symbols ?? []]));
1028
1278
  const unannounced = [
1029
1279
  ...input.diff.removed.filter((name) => !disruptive.has(name)).map((name) => ({ kind: "removed", name })),
1030
1280
  ...input.diff.withdrawn.filter((entry) => !disruptive.has(entry.name)).map((entry) => ({ from: entry.from, kind: "withdrawn", name: entry.name })),
1031
- ...input.diff.changed.filter((change2) => !mentioned.has(change2.name) && change2.shape !== "unknown").map((change2) => ({ kind: change2.shape, name: change2.name }))
1281
+ ...input.diff.changed.filter((change) => !mentioned.has(change.name) && change.shape !== "unknown").map((change) => ({ kind: change.shape, name: change.name }))
1032
1282
  ];
1033
1283
  const unknownSymbols = [
1034
- ...new Set(input.changes.flatMap((change2) => [...change2.symbols ?? []]).filter((name) => !input.known.has(name)))
1284
+ ...new Set(input.changes.flatMap((change) => [...change.symbols ?? []]).filter((name) => !input.known.has(name)))
1035
1285
  ];
1036
1286
  const { after } = input;
1037
- const wrongMigrations = after === undefined ? [] : input.changes.filter(isDisruptive).flatMap((change2) => migrationHolds({
1287
+ const wrongMigrations = after === undefined ? [] : input.changes.filter(isDisruptive).flatMap((change) => migrationHolds({
1038
1288
  after,
1039
- change: change2,
1289
+ change,
1040
1290
  subpaths: input.subpaths ?? new Set
1041
1291
  }));
1042
1292
  return { unannounced, unknownSymbols, wrongMigrations };
@@ -1135,7 +1385,7 @@ var publishedChangelog = async (name, version, options = {}) => {
1135
1385
  const archive = await packageArchive(name, version, options);
1136
1386
  if (!archive)
1137
1387
  return;
1138
- const file = readTar(archive, (path2) => path2 === CHANGELOG_FILE).get(CHANGELOG_FILE);
1388
+ const file = readTar(archive, (path) => path === CHANGELOG_FILE).get(CHANGELOG_FILE);
1139
1389
  if (!file)
1140
1390
  return;
1141
1391
  try {
@@ -1176,21 +1426,25 @@ var migrationLine = (migration) => {
1176
1426
  return `Import \`${migration.moved.symbol}\` from \`${migration.moved.to}\` instead of \`${migration.moved.from}\`.`;
1177
1427
  if ("resubpath" in migration)
1178
1428
  return `Import from \`${migration.resubpath.to}\` instead of \`${migration.resubpath.from}\`.`;
1429
+ if ("methods" in migration)
1430
+ return `${Object.entries(migration.methods.renames).map(([before, after]) => `\`.${before}()\` is now \`.${after}()\``).join(", ")} on \`${migration.methods.owner.export}\`.`;
1431
+ if ("dependencies" in migration)
1432
+ return `Move ${migration.dependencies.names.map((name) => `\`${name}\``).join(", ")} to \`${migration.dependencies.range}\`.`;
1179
1433
  return migration.instruction;
1180
1434
  };
1181
- var renderChange = (change2) => {
1182
- const symbols = change2.symbols && change2.symbols.length > 0 ? ` (${change2.symbols.map((name) => `\`${name}\``).join(", ")})` : "";
1183
- const lines = [`- **${change2.summary}**${symbols}`];
1184
- if (change2.detail !== undefined)
1185
- lines.push(` ${change2.detail}`);
1186
- if (isDisruptive(change2)) {
1187
- lines.push(` _Migration:_ ${change2.migration.instruction}`);
1188
- const mechanical = migrationLine(change2.migration);
1189
- if (mechanical !== change2.migration.instruction)
1435
+ var renderChange = (change) => {
1436
+ const symbols = change.symbols && change.symbols.length > 0 ? ` (${change.symbols.map((name) => `\`${name}\``).join(", ")})` : "";
1437
+ const lines = [`- **${change.summary}**${symbols}`];
1438
+ if (change.detail !== undefined)
1439
+ lines.push(` ${change.detail}`);
1440
+ if (isDisruptive(change)) {
1441
+ lines.push(` _Migration:_ ${change.migration.instruction}`);
1442
+ const mechanical = migrationLine(change.migration);
1443
+ if (mechanical !== change.migration.instruction)
1190
1444
  lines.push(` _Applied automatically:_ ${mechanical}`);
1191
1445
  }
1192
- if (change2.reference !== undefined)
1193
- lines.push(` See ${change2.reference}.`);
1446
+ if (change.reference !== undefined)
1447
+ lines.push(` See ${change.reference}.`);
1194
1448
  return lines.join(`
1195
1449
  `);
1196
1450
  };
@@ -1217,13 +1471,13 @@ var renderChangelogJson = (changelog) => `${JSON.stringify({
1217
1471
  contract: CHANGELOG_CONTRACT,
1218
1472
  name: changelog.name,
1219
1473
  releases: [...changelog.releases].sort((left, right) => compareVersions(right.version, left.version)).map((release) => ({
1220
- changes: release.changes.map((change2) => ({
1221
- ...change2.detail === undefined ? {} : { detail: change2.detail },
1222
- kind: change2.kind,
1223
- ...isDisruptive(change2) ? { migration: change2.migration } : {},
1224
- ...change2.reference === undefined ? {} : { reference: change2.reference },
1225
- summary: change2.summary,
1226
- ...change2.symbols && change2.symbols.length > 0 ? { symbols: change2.symbols } : {}
1474
+ changes: release.changes.map((change) => ({
1475
+ ...change.detail === undefined ? {} : { detail: change.detail },
1476
+ kind: change.kind,
1477
+ ...isDisruptive(change) ? { migration: change.migration } : {},
1478
+ ...change.reference === undefined ? {} : { reference: change.reference },
1479
+ summary: change.summary,
1480
+ ...change.symbols && change.symbols.length > 0 ? { symbols: change.symbols } : {}
1227
1481
  })),
1228
1482
  date: release.date,
1229
1483
  ...release.note === undefined ? {} : { note: release.note },
@@ -1260,6 +1514,7 @@ export {
1260
1514
  CHANGE_KINDS,
1261
1515
  DISRUPTIVE_KINDS,
1262
1516
  UNRELEASED_DIRECTORY,
1517
+ applyDependencyMigrations,
1263
1518
  applyMigration,
1264
1519
  applyMigrations,
1265
1520
  asText,
@@ -1275,6 +1530,7 @@ export {
1275
1530
  diffSurface,
1276
1531
  disruptiveBetween,
1277
1532
  forgetRegistry,
1533
+ isDependencyMigration,
1278
1534
  isDisruptive,
1279
1535
  isMechanical,
1280
1536
  isPackageName,
@@ -1307,5 +1563,5 @@ export {
1307
1563
  validateChange
1308
1564
  };
1309
1565
 
1310
- //# debugId=2BE6EC2364C69ED864756E2164756E21
1566
+ //# debugId=0052F7389999EA8F64756E2164756E21
1311
1567
  //# sourceMappingURL=index.js.map