Skip to content

Commit bc67d8d

Browse files
committed
refactor
1 parent 37eb9d8 commit bc67d8d

File tree

8 files changed

+120
-40
lines changed

8 files changed

+120
-40
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,32 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88

99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
12-
strategy:
13-
matrix:
14-
deno-version: [v1.x]
1512
steps:
1613
- name: Git Checkout Deno Module
17-
uses: actions/checkout@v2
18-
- name: Use Deno Version ${{ matrix.deno-version }}
19-
uses: denoland/setup-deno@v1
14+
uses: actions/checkout@v4
15+
- uses: denoland/setup-deno@v2
2016
with:
21-
deno-version: ${{ matrix.deno-version }}
17+
deno-version: vx.x.x
2218
- name: Format
2319
run: deno fmt --check
2420
- name: Lint
2521
run: deno lint
2622
- name: Unit Test
2723
run: deno test --coverage=coverage
2824
- name: Create coverage report
29-
run: deno coverage ./coverage --lcov > coverage.lcov
25+
run: deno coverage ./coverage --lcov > coverage.lcov
3026
- name: Collect coverage
31-
uses: codecov/codecov-action@v1.0.10
27+
uses: codecov/codecov-action@v5
3228
with:
33-
file: ./coverage.lcov
29+
token: ${{ secrets.CODECOV_TOKEN }}
30+
slug: denostack/intlit
31+
files: ./coverage.lcov
3432
- name: Build Module
3533
run: deno task build:npm

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
.npm
2-
deno.lock

deno.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
"test": "deno task test:unit && deno task test:lint && deno task test:format && deno task test:types",
66
"test:format": "deno fmt --check",
77
"test:lint": "deno lint",
8-
"test:unit": "deno test -A",
9-
"test:types": "deno check mod.ts",
10-
"build:npm": "deno run --allow-sys --allow-env --allow-read --allow-write --allow-net --allow-run scripts/build_npm.ts"
8+
"test:unit": "deno test",
9+
"test:types": "find . -name '*.ts' -not -path './.npm/*' | xargs deno check",
10+
"build:npm": "deno run --allow-env --allow-read --allow-write --allow-run scripts/build_npm.ts"
1111
},
1212
"imports": {
13-
"@deno/dnt": "jsr:@deno/dnt@^0.41.1",
14-
"@std/assert": "jsr:@std/assert@^0.221.0",
15-
"@std/fmt": "jsr:@std/fmt@^0.221.0"
13+
"@deno/dnt": "jsr:@deno/dnt@^0.42.3",
14+
"@std/assert": "jsr:@std/assert@^1.0.15",
15+
"@std/fmt": "jsr:@std/fmt@^1.0.8"
1616
},
1717
"exports": {
1818
".": "./mod.ts",
@@ -26,5 +26,11 @@
2626
"fmt": {
2727
"exclude": [".npm"]
2828
},
29-
"lock": false
29+
"publish": {
30+
"exclude": [
31+
".github",
32+
".vscode",
33+
"scripts"
34+
]
35+
}
3036
}

deno.lock

Lines changed: 78 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

iterable_weak_map.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,21 @@ export class IterableWeakMap<K extends object, V>
6060
}
6161
}
6262

63-
*[Symbol.iterator](): IterableIterator<[K, V]> {
63+
*[Symbol.iterator](): MapIterator<[K, V]> {
6464
for (const key of this.#set) {
6565
yield [key, this.#weakMap.get(key)!];
6666
}
6767
}
6868

69-
entries(): IterableIterator<[K, V]> {
69+
entries(): MapIterator<[K, V]> {
7070
return this[Symbol.iterator]();
7171
}
7272

73-
keys(): IterableIterator<K> {
73+
keys(): MapIterator<K> {
7474
return this.#set[Symbol.iterator]();
7575
}
7676

77-
*values(): IterableIterator<V> {
77+
*values(): MapIterator<V> {
7878
for (const key of this.#set) {
7979
yield this.#weakMap.get(key)!;
8080
}

iterable_weak_set.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,24 @@ export class IterableWeakSet<T extends object> implements
7575
return "IterableWeakSet";
7676
}
7777

78-
*[Symbol.iterator](): IterableIterator<T> {
78+
*[Symbol.iterator](): SetIterator<T> {
7979
for (const ref of this.#set) {
8080
yield ref.deref()!;
8181
}
8282
}
8383

84-
*entries(): IterableIterator<[T, T]> {
84+
*entries(): SetIterator<[T, T]> {
8585
for (const ref of this.#set) {
8686
const value = ref.deref()!;
8787
yield [value, value];
8888
}
8989
}
9090

91-
keys(): IterableIterator<T> {
91+
keys(): SetIterator<T> {
9292
return this[Symbol.iterator]();
9393
}
9494

95-
values(): IterableIterator<T> {
95+
values(): SetIterator<T> {
9696
return this[Symbol.iterator]();
9797
}
9898
}

scripts/build_npm.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { build, emptyDir } from "@deno/dnt";
22
import { bgGreen } from "@std/fmt/colors";
3+
import denoJson from "../deno.json" with { type: "json" };
34

4-
const denoInfo = JSON.parse(
5-
Deno.readTextFileSync(new URL("../deno.json", import.meta.url)),
6-
);
7-
const version = denoInfo.version;
5+
const version = denoJson.version;
86

97
console.log(bgGreen(`version: ${version}`));
108

@@ -17,7 +15,7 @@ await build({
1715
outDir: "./.npm",
1816
test: false,
1917
compilerOptions: {
20-
lib: ["ES2022"],
18+
lib: ["ES2021"],
2119
},
2220
shims: {
2321
deno: false,
@@ -44,7 +42,8 @@ await build({
4442
url: "https://github.com/denostack/weakref/issues",
4543
},
4644
},
45+
postBuild() {
46+
Deno.copyFileSync("LICENSE", ".npm/LICENSE");
47+
Deno.copyFileSync("README.md", ".npm/README.md");
48+
},
4749
});
48-
49-
// post build steps
50-
Deno.copyFileSync("README.md", ".npm/README.md");

weak_value_map.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,21 @@ export class WeakValueMap<K, V extends object> implements Map<K, V> {
5858
}
5959
}
6060

61-
*[Symbol.iterator](): IterableIterator<[K, V]> {
61+
*[Symbol.iterator](): MapIterator<[K, V]> {
6262
for (const [key, ref] of this.#map) {
6363
yield [key, ref.deref()!];
6464
}
6565
}
6666

67-
entries(): IterableIterator<[K, V]> {
67+
entries(): MapIterator<[K, V]> {
6868
return this[Symbol.iterator]();
6969
}
7070

71-
keys(): IterableIterator<K> {
71+
keys(): MapIterator<K> {
7272
return this.#map.keys();
7373
}
7474

75-
*values(): IterableIterator<V> {
75+
*values(): MapIterator<V> {
7676
for (const ref of this.#map.values()) {
7777
yield ref.deref()!;
7878
}

0 commit comments

Comments
 (0)