Skip to content

Commit c92edee

Browse files
committed
docs: add svg size
1 parent 2bdf9b8 commit c92edee

9 files changed

Lines changed: 196 additions & 100 deletions

File tree

.export-size-svg.mjs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { defineConfig } from "export-size-svg";
2+
3+
export default defineConfig({
4+
title: "@embra/reactivity",
5+
out: "./docs/assets",
6+
exports: [
7+
{
8+
title: "*",
9+
code: "export * from './src/index.ts'",
10+
},
11+
{
12+
title: "{ readable, writable } (core)",
13+
code: "export { readable, writable } from './src/index.ts'",
14+
},
15+
{
16+
title: "{ watch }",
17+
code: "export { watch } from './src/watch.ts'",
18+
externals: ["./batch", "./utils"],
19+
},
20+
{
21+
title: "{ compute }",
22+
code: "export { compute } from './src/compute.ts'",
23+
externals: ["./readable", "./utils"],
24+
},
25+
{
26+
title: "{ combine }",
27+
code: "export { combine } from './src/combine.ts'",
28+
externals: ["./compute"],
29+
},
30+
{
31+
title: "{ derive }",
32+
code: "export { derive } from './src/derive.ts'",
33+
externals: ["./compute"],
34+
},
35+
{
36+
title: "{ reactiveMap }",
37+
code: "export { reactiveMap } from './src/collections/reactiveMap.ts'",
38+
externals: ["../batch", "../readable", "../utils"],
39+
},
40+
{
41+
title: "{ reactiveSet }",
42+
code: "export { reactiveSet } from './src/collections/reactiveSet.ts'",
43+
externals: ["../batch", "../readable", "../utils"],
44+
},
45+
],
46+
});

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
[![Build Status](https://github.com/embrajs/reactivity/actions/workflows/build.yml/badge.svg)](https://github.com/embrajs/reactivity/actions/workflows/build.yml)
99
[![npm-version](https://img.shields.io/npm/v/embra/reactivity.svg)](https://www.npmjs.com/package/embra/reactivity)
1010
[![Coverage Status](https://img.shields.io/coverallsCoverage/github/embrajs/reactivity)](https://coveralls.io/github/embrajs/reactivity)
11-
[![minified-size](https://img.shields.io/bundlephobia/minzip/embra/reactivity)](https://bundlephobia.com/package/embra/reactivity)
1211

1312
Chainable, hook-flavored signals.
1413

@@ -17,3 +16,5 @@ Chainable, hook-flavored signals.
1716
```bash
1817
npm add @embra/reactivity
1918
```
19+
20+
![export size](https://embra.github.io/reactivity/assets/export-size.svg)

package-lock.json

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

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"lint": "eslint && prettier --check .",
2222
"lint:fix": "eslint --fix && prettier --write .",
2323
"ts-check": "tsc --noEmit",
24-
"docs": "typedoc --options typedoc.json && prettier --ignore-path .prettierignore --write docs",
24+
"docs": "typedoc --options typedoc.json && prettier --ignore-path .prettierignore --write docs && export-size-svg",
2525
"test": "vitest",
2626
"test:coverage": "vitest --coverage",
2727
"test:ci": "vitest --coverage",
@@ -46,6 +46,7 @@
4646
"@wopjs/gzip-size": "^0.1.2",
4747
"commit-and-tag-version": "^12.5.1",
4848
"eslint": "^9.31.0",
49+
"export-size-svg": "^0.0.5",
4950
"jest-extended": "^6.0.0",
5051
"prettier": "^3.6.2",
5152
"tsup": "^8.5.0",

src/derive.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export interface Derive {
55
/**
66
* Derive a new Readable with same value from the given Readable.
77
* @param dep$ - The Readable to derive from.
8-
* @param config - Custom config for the derived Readable.
98
* @returns A Readable with same value as the given Readable.
109
*/
1110
<TDepValue = any, TValue = any>(dep$: Readable<TDepValue>): OwnedReadable<TValue>;
@@ -18,7 +17,7 @@ export interface Derive {
1817
*/
1918
<TDepValue = any, TValue = any>(
2019
dep$: Readable<TDepValue>,
21-
transform: (depValue: TDepValue) => TValue,
20+
transform?: (depValue: TDepValue) => TValue,
2221
config?: Config<TValue>,
2322
): OwnedReadable<TValue>;
2423
}

src/index.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
export type {
22
Get,
33
Readable,
4-
Unwrap,
4+
OwnedReadable,
55
Writable,
6+
OwnedWritable,
67
Config,
78
Disposer,
89
Equal,
9-
SetValue,
1010
Subscriber,
11+
SetValue,
1112
Version,
13+
Unwrap,
1214
} from "./typings";
1315

1416
export { type Listener, type RemoveListener } from "./event";
@@ -17,12 +19,12 @@ export { batch, batchFlush, batchStart } from "./batch";
1719

1820
export { compute, type ComputeFn } from "./compute";
1921
export { derive, type Derive } from "./derive";
20-
export { combine, type Combine } from "./combine";
22+
export { combine, type Combine, type MapReadablesToValues } from "./combine";
2123

22-
export { readable, writable, toWritable } from "./readable";
24+
export { readable, type CreateReadable, writable, type CreateWritable, toWritable, type ToWritable } from "./readable";
2325
export { watch, type WatchEffect } from "./watch";
2426

25-
export { isReadable, unsubscribe, strictEqual, arrayShallowEqual } from "./utils";
27+
export { isReadable, type IsReadable, unsubscribe, strictEqual, arrayShallowEqual } from "./utils";
2628

2729
export {
2830
reactiveMap,

src/readable.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const registry = /* @__PURE__ */ new FinalizationRegistry<{
2323
}
2424
});
2525

26-
interface CreateReadable {
26+
export interface CreateReadable {
2727
/**
2828
* Creates a Readonly with the given value.
2929
*
@@ -61,6 +61,9 @@ interface CreateReadable {
6161

6262
/** @internal */
6363
export class ReadableImpl<TValue = any> implements BatchTask {
64+
/**
65+
* @internal
66+
*/
6467
public readonly [BRAND]: BRAND = BRAND;
6568

6669
/**
@@ -358,7 +361,7 @@ export const toWritable: ToWritable = <TValue>(
358361
set: (this: void, value: TValue) => void,
359362
): OwnedWritable<TValue> => ((($ as OwnedWritable<TValue>).set = set), $ as OwnedWritable<TValue>);
360363

361-
interface CreateWritable {
364+
export interface CreateWritable {
362365
/**
363366
* Creates a Writable.
364367
* @returns A Writable with undefined value.

src/typings.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ export interface Readable<TValue = any> {
3535
* If two versions of a $ is not equal(`Object.is`), it means the `value` has changed (event if the `value` is equal).
3636
*/
3737
readonly $version: Version;
38+
/**
39+
* @internal
40+
*/
3841
readonly [BRAND]: BRAND;
3942
/**
4043
* Current value of the $.

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const arrayShallowEqual = (arrA: any, arrB: any): boolean => {
6161
return true;
6262
};
6363

64-
interface IsReadable {
64+
export interface IsReadable {
6565
<T extends Readable>($: T): $ is T;
6666
($: unknown): $ is Readable;
6767
($: any): $ is Readable;

0 commit comments

Comments
 (0)