Skip to content

Commit 077bc09

Browse files
committed
feat: Add experimental support for explicit resource management
Use explicit resource management bump packages Override symbol test add debug console
1 parent f9fcd39 commit 077bc09

57 files changed

Lines changed: 4306 additions & 3946 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: 'CI'
1+
name: "CI"
22

33
on:
44
push:
55
branches:
66
- main
77
pull_request:
88
branches:
9-
- '*'
9+
- "*"
1010
workflow_call:
1111
workflow_dispatch:
1212

@@ -23,7 +23,7 @@ jobs:
2323
- name: Use Node.js
2424
uses: actions/setup-node@v3
2525
with:
26-
node-version: 18
26+
node-version: "20.5.1"
2727
cache: yarn
2828

2929
- name: Install dependencies
@@ -42,7 +42,7 @@ jobs:
4242
with:
4343
flags: unit
4444
token: ${{ secrets.CODECOV_TOKEN }}
45-
45+
4646
test-e2e:
4747
name: E2E Test
4848
runs-on: ubuntu-latest
@@ -79,7 +79,7 @@ jobs:
7979
- name: Setup Node.js
8080
uses: actions/setup-node@v3
8181
with:
82-
node-version: 18
82+
node-version: "20.5.1"
8383
cache: yarn
8484

8585
- name: Setup Mastodon

.github/workflows/publish-docs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Setup Node.js
2222
uses: actions/setup-node@v3
2323
with:
24-
node-version: '18'
24+
node-version: "20.5.1"
2525
cache: yarn
2626

2727
- name: Setup Pages
@@ -34,7 +34,7 @@ jobs:
3434
- name: Upload artifact
3535
uses: actions/upload-pages-artifact@v1
3636
with:
37-
path: './docs'
37+
path: "./docs"
3838

3939
deploy:
4040
runs-on: ubuntu-latest

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Publish
33
on:
44
workflow_dispatch:
55
schedule:
6-
- cron: '0 0 * * *'
6+
- cron: "0 0 * * *"
77

88
jobs:
99
test:
@@ -26,7 +26,7 @@ jobs:
2626
- name: Use Node.js
2727
uses: actions/setup-node@v3
2828
with:
29-
node-version: '18'
29+
node-version: "20.5.1"
3030
cache: yarn
3131

3232
- run: yarn install --frozen-lockfiles

jest.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export default {
1616
"ts-jest",
1717
{
1818
tsconfig: {
19-
target: "esnext",
20-
module: "esnext",
19+
target: "ES2022",
20+
module: "ES2022",
2121
},
2222
},
2323
],

package.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,40 +37,40 @@
3737
"ws": "^8.13.0"
3838
},
3939
"devDependencies": {
40-
"@rollup/plugin-commonjs": "^25.0.3",
40+
"@rollup/plugin-commonjs": "^25.0.4",
4141
"@rollup/plugin-json": "^6.0.0",
4242
"@semantic-release/changelog": "^6.0.3",
4343
"@semantic-release/git": "^10.0.1",
44-
"@types/jest": "^29.5.2",
45-
"@types/node": "^20.3.3",
44+
"@types/jest": "^29.5.4",
45+
"@types/node": "^20.5.7",
4646
"@types/proper-lockfile": "^4.1.2",
4747
"@types/ws": "^8.5.5",
48-
"@typescript-eslint/eslint-plugin": "^5.62.0",
49-
"@typescript-eslint/parser": "^5.62.0",
50-
"conventional-changelog-conventionalcommits": "^6.1.0",
51-
"cspell": "^6.31.1",
52-
"eslint": "^8.44.0",
53-
"eslint-config-prettier": "^8.8.0",
54-
"eslint-plugin-import": "^2.27.5",
55-
"eslint-plugin-prettier": "^4.0.0",
48+
"@typescript-eslint/eslint-plugin": "^6.5.0",
49+
"@typescript-eslint/parser": "^6.5.0",
50+
"conventional-changelog-conventionalcommits": "^7.0.1",
51+
"cspell": "^7.2.0",
52+
"eslint": "^8.48.0",
53+
"eslint-config-prettier": "^9.0.0",
54+
"eslint-plugin-import": "^2.28.1",
55+
"eslint-plugin-prettier": "^5.0.0",
5656
"eslint-plugin-simple-import-sort": "^10.0.0",
57-
"eslint-plugin-unicorn": "^47.0.0",
57+
"eslint-plugin-unicorn": "^48.0.1",
5858
"get-port": "^5.1.1",
5959
"iterator-helpers-polyfill": "^2.3.1",
60-
"jest": "^29.5.0",
60+
"jest": "^29.6.4",
6161
"npm-run-all": "^4.1.5",
62-
"prettier": "^2.8.8",
62+
"prettier": "^3.0.3",
6363
"proper-lockfile": "^4.1.2",
64-
"rollup": "^3.26.3",
64+
"rollup": "^3.28.1",
6565
"rollup-plugin-auto-external": "^2.0.0",
66-
"rollup-plugin-dts": "^5.3.0",
66+
"rollup-plugin-dts": "^6.0.0",
6767
"rollup-plugin-node-globals": "^1.4.0",
68-
"rollup-plugin-typescript2": "^0.35.0",
69-
"semantic-release": "^21.0.6",
68+
"semantic-release": "^21.1.1",
7069
"ts-jest": "^29.1.1",
71-
"typedoc": "^0.24.8",
72-
"typescript": "^5.1.6",
73-
"undici": "^5.22.1"
70+
"tslib": "^2.6.2",
71+
"typedoc": "^0.25.0",
72+
"typescript": "^5.2.2",
73+
"undici": "^5.23.0"
7474
},
7575
"files": [
7676
"README.md",

src/adapters/action/paginator-http.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export class PaginatorHttp<Entity, Params = undefined>
6262
) => TResult2 | PromiseLike<TResult2> = Promise.reject.bind(Promise),
6363
): Promise<TResult1 | TResult2> {
6464
// we assume the first item won't be undefined
65+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
6566
return this.next().then((value) => onfulfilled(value.value!), onrejected);
6667
}
6768

@@ -88,6 +89,7 @@ export class PaginatorHttp<Entity, Params = undefined>
8889
undefined,
8990
Params | string | undefined
9091
> {
92+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
9193
return this as any as AsyncIterator<
9294
Entity,
9395
undefined,

src/adapters/action/proxy.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
12
import { type Action } from "../../interfaces";
23
import { createActionProxy } from "./proxy";
34

src/adapters/http/http-native-impl.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ describe("HttpNativeImpl", () => {
9595
);
9696

9797
expect(error.message).toEqual("unknown error");
98+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
9899
expect((error.additionalProperties as any).foo).toEqual("bar");
99100

100101
server.close();

src/adapters/http/http-native-impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export class HttpNativeImpl extends BaseHttp implements Http {
3535
});
3636
const response = await fetch(request);
3737
if (!response.ok) {
38-
// eslint-disable-next-line @typescript-eslint/no-throw-literal
3938
throw response;
4039
}
4140

@@ -116,6 +115,7 @@ export class HttpNativeImpl extends BaseHttp implements Http {
116115
);
117116
}
118117

118+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
119119
if (error != undefined && (error as any).name === "AbortError") {
120120
return new MastoTimeoutError(`Request timed out`, { cause: error });
121121
}

src/adapters/ws/web-socket-subscription.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ export class WebSocketSubscription implements mastodon.streaming.Subscription {
6363
return this.values();
6464
}
6565

66+
/**
67+
* @experimental This is an experimental API.
68+
*/
69+
[Symbol.dispose](): void {
70+
this.unsubscribe();
71+
}
72+
6673
private matches(event: mastodon.streaming.Event): boolean {
6774
// subscribe("hashtag", { tag: "foo" }) -> ["hashtag", "foo"]
6875
// subscribe("list", { list: "foo" }) -> ["list", "foo"]

0 commit comments

Comments
 (0)