@absolutejs/changelog 0.7.1 → 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/CHANGELOG.md +7 -0
- package/changelog.json +17 -0
- package/dist/apply.d.ts +5 -1
- package/dist/applyDependencies.d.ts +13 -0
- package/dist/applyMethods.d.ts +16 -0
- package/dist/cli.js +25 -2
- package/dist/cli.js.map +5 -5
- package/dist/index.d.ts +2 -1
- package/dist/index.js +281 -57
- package/dist/index.js.map +9 -7
- package/dist/types.d.ts +39 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,13 @@ This file is generated by `absolute-changelog` from the entries in
|
|
|
6
6
|
`changelog/`. Edit an entry, not this file — and add new ones under
|
|
7
7
|
`changelog/unreleased/`.
|
|
8
8
|
|
|
9
|
+
## 0.8.0 — 2026-11-19
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **Migrations can rename a class's methods and move dependencies** (`Migration`, `applyMigration`, `applyDependencyMigrations`, `isDependencyMigration`)
|
|
14
|
+
A method renamed on a class's instances (`new Elysia().beforeHandle(...)` to `.onBeforeHandle(...)`) and a peer that has to move with a release (Elysia to 2.0.0-rc.0) are now data a project can have applied, like a renamed export. A method is renamed only where the file shows its receiver is an instance; a dependency moves only where it is a version range below the one asked for.
|
|
15
|
+
|
|
9
16
|
## 0.7.1 — 2026-10-07
|
|
10
17
|
|
|
11
18
|
### Fixed
|
package/changelog.json
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
"contract": 1,
|
|
3
3
|
"name": "@absolutejs/changelog",
|
|
4
4
|
"releases": [
|
|
5
|
+
{
|
|
6
|
+
"changes": [
|
|
7
|
+
{
|
|
8
|
+
"detail": "A method renamed on a class's instances (`new Elysia().beforeHandle(...)` to `.onBeforeHandle(...)`) and a peer that has to move with a release (Elysia to 2.0.0-rc.0) are now data a project can have applied, like a renamed export. A method is renamed only where the file shows its receiver is an instance; a dependency moves only where it is a version range below the one asked for.",
|
|
9
|
+
"kind": "added",
|
|
10
|
+
"summary": "Migrations can rename a class's methods and move dependencies",
|
|
11
|
+
"symbols": [
|
|
12
|
+
"Migration",
|
|
13
|
+
"applyMigration",
|
|
14
|
+
"applyDependencyMigrations",
|
|
15
|
+
"isDependencyMigration"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"date": "2026-11-19",
|
|
20
|
+
"version": "0.8.0"
|
|
21
|
+
},
|
|
5
22
|
{
|
|
6
23
|
"changes": [
|
|
7
24
|
{
|
package/dist/apply.d.ts
CHANGED
|
@@ -17,7 +17,11 @@ export declare const applyMigration: (source: string, input: {
|
|
|
17
17
|
migration: Migration;
|
|
18
18
|
packageName: string;
|
|
19
19
|
path?: string;
|
|
20
|
-
}) =>
|
|
20
|
+
}) => {
|
|
21
|
+
changed: boolean;
|
|
22
|
+
notes: string[];
|
|
23
|
+
source: string;
|
|
24
|
+
};
|
|
21
25
|
/**
|
|
22
26
|
* Apply migrations in order.
|
|
23
27
|
*
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Migration } from "./types";
|
|
2
|
+
export type DependencyEdit = {
|
|
3
|
+
from: string;
|
|
4
|
+
name: string;
|
|
5
|
+
section: string;
|
|
6
|
+
to: string;
|
|
7
|
+
};
|
|
8
|
+
type Outcome = {
|
|
9
|
+
edits: DependencyEdit[];
|
|
10
|
+
manifest: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const applyDependencyMigrations: (manifest: string, migrations: readonly Migration[]) => Outcome;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import type { Migration } from "./types";
|
|
3
|
+
type MethodsMigration = Extract<Migration, {
|
|
4
|
+
methods: unknown;
|
|
5
|
+
}>;
|
|
6
|
+
type Result = {
|
|
7
|
+
changed: boolean;
|
|
8
|
+
notes: string[];
|
|
9
|
+
source: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const applyMethods: (input: {
|
|
12
|
+
file: ts.SourceFile;
|
|
13
|
+
methods: MethodsMigration["methods"];
|
|
14
|
+
source: string;
|
|
15
|
+
}) => Result;
|
|
16
|
+
export {};
|
package/dist/cli.js
CHANGED
|
@@ -28,6 +28,7 @@ var CHANGELOG_CONTRACT = 1;
|
|
|
28
28
|
var CHANGELOG_FILE = "changelog.json";
|
|
29
29
|
var CHANGELOG_MARKDOWN = "CHANGELOG.md";
|
|
30
30
|
var UNRELEASED_DIRECTORY = "changelog/unreleased";
|
|
31
|
+
var isDependencyMigration = (migration) => ("dependencies" in migration);
|
|
31
32
|
var isDisruptive = (change) => change.kind === "breaking" || change.kind === "removed";
|
|
32
33
|
var isMechanical = (migration) => !("manual" in migration);
|
|
33
34
|
|
|
@@ -145,9 +146,27 @@ var readMigration = (value, where, problems) => {
|
|
|
145
146
|
instruction,
|
|
146
147
|
resubpath: { from: resubpath.from, to: resubpath.to }
|
|
147
148
|
};
|
|
149
|
+
const { methods } = value;
|
|
150
|
+
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))
|
|
151
|
+
return {
|
|
152
|
+
instruction,
|
|
153
|
+
methods: {
|
|
154
|
+
owner: { export: methods.owner.export, module: methods.owner.module },
|
|
155
|
+
renames: Object.fromEntries(Object.entries(methods.renames).filter((entry) => isText(entry[1])))
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const { dependencies } = value;
|
|
159
|
+
if (isRecord(dependencies) && isText(dependencies.range) && Array.isArray(dependencies.names) && dependencies.names.length > 0 && dependencies.names.every(isText)) {
|
|
160
|
+
const [first, ...rest] = dependencies.names.filter((name) => isText(name));
|
|
161
|
+
if (first !== undefined)
|
|
162
|
+
return {
|
|
163
|
+
dependencies: { names: [first, ...rest], range: dependencies.range },
|
|
164
|
+
instruction
|
|
165
|
+
};
|
|
166
|
+
}
|
|
148
167
|
if (value.manual === true)
|
|
149
168
|
return { instruction, manual: true };
|
|
150
|
-
problems.push(`${where}: migration says neither rename, moved, resubpath nor manual`);
|
|
169
|
+
problems.push(`${where}: migration says neither rename, moved, resubpath, methods, dependencies nor manual`);
|
|
151
170
|
return;
|
|
152
171
|
};
|
|
153
172
|
var readChange = (value, where, problems) => {
|
|
@@ -926,6 +945,10 @@ var migrationLine = (migration) => {
|
|
|
926
945
|
return `Import \`${migration.moved.symbol}\` from \`${migration.moved.to}\` instead of \`${migration.moved.from}\`.`;
|
|
927
946
|
if ("resubpath" in migration)
|
|
928
947
|
return `Import from \`${migration.resubpath.to}\` instead of \`${migration.resubpath.from}\`.`;
|
|
948
|
+
if ("methods" in migration)
|
|
949
|
+
return `${Object.entries(migration.methods.renames).map(([before, after]) => `\`.${before}()\` is now \`.${after}()\``).join(", ")} on \`${migration.methods.owner.export}\`.`;
|
|
950
|
+
if ("dependencies" in migration)
|
|
951
|
+
return `Move ${migration.dependencies.names.map((name) => `\`${name}\``).join(", ")} to \`${migration.dependencies.range}\`.`;
|
|
929
952
|
return migration.instruction;
|
|
930
953
|
};
|
|
931
954
|
var renderChange = (change) => {
|
|
@@ -1365,5 +1388,5 @@ await main().catch((error) => {
|
|
|
1365
1388
|
process.exit(1);
|
|
1366
1389
|
});
|
|
1367
1390
|
|
|
1368
|
-
//# debugId=
|
|
1391
|
+
//# debugId=F85103537D4064B364756E2164756E21
|
|
1369
1392
|
//# sourceMappingURL=cli.js.map
|