@pluv/io 0.44.2 → 1.0.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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +16 -0
- package/README.md +133 -68
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
- package/src/version.generated.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/io@0.
|
|
2
|
+
> @pluv/io@1.0.0 build /home/runner/work/pluv/pluv/packages/io
|
|
3
3
|
> pnpm run version && tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @pluv/io@0.
|
|
6
|
+
> @pluv/io@1.0.0 version /home/runner/work/pluv/pluv/packages/io
|
|
7
7
|
> genversion ./src/version.generated.ts --esm
|
|
8
8
|
|
|
9
9
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
[34mCLI[39m Target: es6
|
|
13
13
|
[34mESM[39m Build start
|
|
14
14
|
[34mCJS[39m Build start
|
|
15
|
-
[32mCJS[39m [1mdist/index.js [22m[32m52.90 KB[39m
|
|
16
|
-
[32mCJS[39m ⚡️ Build success in 124ms
|
|
17
15
|
[32mESM[39m [1mdist/index.mjs [22m[32m50.73 KB[39m
|
|
18
|
-
[32mESM[39m ⚡️ Build success in
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 132ms
|
|
17
|
+
[32mCJS[39m [1mdist/index.js [22m[32m52.90 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 133ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 2976ms
|
|
21
21
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m32.19 KB[39m
|
|
22
22
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m32.19 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @pluv/io
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- af94706: pluv.io is now stable and production ready!
|
|
8
|
+
|
|
9
|
+
With this v1 release, pluv.io will now follow [semantic versioning](https://semver.org/) with more comprehensive release notes for future changes to the library.
|
|
10
|
+
|
|
11
|
+
Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [af94706]
|
|
16
|
+
- @pluv/crdt@1.0.0
|
|
17
|
+
- @pluv/types@1.0.0
|
|
18
|
+
|
|
3
19
|
## 0.44.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<img src="https://github.com/pluv-io/pluv/blob/master/assets/pluv-icon-192x192.png?raw=true" alt="Pluv.IO" width="180" style="border-radius:16px" />
|
|
7
|
-
<br />
|
|
8
|
-
<a href="https://pluv.io/docs/introduction">Pluv.IO (preview)</a>
|
|
9
|
-
<br />
|
|
10
|
-
</h1>
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://pluv.io/docs/introduction">
|
|
3
|
+
<img src="https://github.com/pluv-io/pluv/blob/master/assets/pluv-icon-192x192.png?raw=true" alt="Pluv.IO" width="156" style="border-radius:16px" />
|
|
4
|
+
</a>
|
|
5
|
+
</div>
|
|
11
6
|
|
|
12
|
-
<
|
|
13
|
-
<
|
|
7
|
+
<h1 align="center">pluv.io</h1>
|
|
8
|
+
<h3 align="center">TypeSafe Primitives for a Realtime Web</h3>
|
|
14
9
|
|
|
15
10
|
<p align="center">
|
|
16
11
|
<a href="https://www.npmjs.com/package/@pluv/io">
|
|
@@ -24,93 +19,163 @@
|
|
|
24
19
|
</a>
|
|
25
20
|
<img src="https://badgen.net/badge/-/TypeScript?icon=typescript&label&labelColor=blue&color=555555" alt="TypeScript" />
|
|
26
21
|
</p>
|
|
27
|
-
|
|
28
|
-
<p align="center">
|
|
29
|
-
<a href="#intro">Intro</a> •
|
|
30
|
-
<a href="#usage">Usage</a> •
|
|
31
|
-
<a href="#related">Related</a> •
|
|
32
|
-
<a href="#credits">Credits</a> •
|
|
33
|
-
<a href="#license">License</a>
|
|
34
|
-
</p>
|
|
22
|
+
<h4 align="center">💕 Inspired by <a href="https://trpc.io">trpc</a> 💕 <a href="https://docs.yjs.dev/">yjs</a> 💕 <br />and <a href="https://workers.cloudflare.com/">Cloudflare Workers</a> 💕</h4>
|
|
35
23
|
|
|
36
24
|
## Intro
|
|
37
25
|
|
|
38
|
-
pluv.io allows you to more easily build
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
26
|
+
**[pluv.io](https://pluv.io) allows you to more easily build realtime multiplayer experiences with a fully typesafe API and powerful abstractions as primitives, so that you can focus on building for your end users.**
|
|
27
|
+
|
|
28
|
+
Self-host on [Cloudflare Workers](https://pluv.io/docs/quickstart/cloudflare-workers) or [Node.js](https://pluv.io/docs/quickstart/nodejs); or [get started on the pluv.io network](https://pluv.io/signup).
|
|
29
|
+
|
|
30
|
+
## Preview
|
|
31
|
+
|
|
32
|
+
Create your pluv.io backend
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
// backend
|
|
36
|
+
const io = createIO(platformNode({ crdt: yjs }));
|
|
37
|
+
|
|
38
|
+
export const ioServer = io.server({
|
|
39
|
+
router: io.router({
|
|
40
|
+
sendGreeting: io.procedure
|
|
41
|
+
.input(z.object({ message: z.string() }))
|
|
42
|
+
.broadcast(({ message }) => ({
|
|
43
|
+
receiveGreeting: { message }
|
|
44
|
+
}))
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Create your frontend client with your backend types
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
// frontend
|
|
53
|
+
const types = infer((i) => ({ io: i<typeof ioServer> }));
|
|
54
|
+
const io = createClient({
|
|
55
|
+
types,
|
|
56
|
+
initialStorage: yjs.doc(() => ({
|
|
57
|
+
messages: yjs.array<string>(),
|
|
58
|
+
})),
|
|
59
|
+
presence: z.object({
|
|
60
|
+
selectionId: z.string().nullable()
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const {
|
|
65
|
+
event,
|
|
66
|
+
useBroadcast,
|
|
67
|
+
useMyPresence,
|
|
68
|
+
useOthers,
|
|
69
|
+
useStorage
|
|
70
|
+
} = createBundle(io);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Use powerful primitives to build realtime features
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
// react
|
|
77
|
+
event.receiveGreeting.useEvent(({ data }) => { /* ... */});
|
|
78
|
+
// ^? const data: { message: string }
|
|
79
|
+
|
|
80
|
+
const broadcast = useBroadcast();
|
|
81
|
+
|
|
82
|
+
broadcast.sendGreeting({ message: "hello world" });
|
|
83
|
+
// ^? const sendGreeting: (data: { message: string }) => void
|
|
84
|
+
|
|
85
|
+
const [mySelection, update] = useMyPresence((presence) => {
|
|
86
|
+
// ^? const mySelection: string | null
|
|
87
|
+
return presence.selectionId;
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const others = useOthers((others) => {
|
|
91
|
+
// ^? const others = string[]
|
|
92
|
+
return others.map((other) => other.presence.selectionId);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const [
|
|
96
|
+
messages,
|
|
97
|
+
// ^? const messages: string[] | null
|
|
98
|
+
sharedType
|
|
99
|
+
// ^? YArray<string> | null
|
|
100
|
+
] = useStorage("messages");
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Documentation
|
|
104
|
+
|
|
105
|
+
The full documentation is available at [pluv.io](https://pluv.io/docs/introduction).
|
|
106
|
+
|
|
107
|
+
## Features
|
|
108
|
+
|
|
109
|
+
- ✅ Automatic type-safety
|
|
45
110
|
- ✅ Basic events
|
|
46
111
|
- ✅ Rooms
|
|
47
112
|
- ✅ Authentication
|
|
48
113
|
- ✅ Awareness + Presence
|
|
49
114
|
- ✅ [CRDTs](https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
- ✅
|
|
60
|
-
- ✅
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
115
|
+
- ✅ [Yjs](https://docs.yjs.dev/)
|
|
116
|
+
- ⬜ [Provider](https://github.com/yjs/yjs?tab=readme-ov-file#providers) (Coming soon!)
|
|
117
|
+
- ✅ **Shared Types**
|
|
118
|
+
- ✅ [Map](https://docs.yjs.dev/api/shared-types/y.map)
|
|
119
|
+
- ✅ [Array](https://docs.yjs.dev/api/shared-types/y.array)
|
|
120
|
+
- ✅ [Text](https://docs.yjs.dev/api/shared-types/y.text)
|
|
121
|
+
- ✅ [XmlFragment](https://docs.yjs.dev/api/shared-types/y.xmlfragment)
|
|
122
|
+
- ✅ [XmlElement](https://docs.yjs.dev/api/shared-types/y.xmlelement)
|
|
123
|
+
- ✅ [XmlText](https://docs.yjs.dev/api/shared-types/y.xmltext)
|
|
124
|
+
- ✅ [Loro](https://loro.dev/) (preview)
|
|
125
|
+
- ✅ **Containers**
|
|
126
|
+
- ✅ List
|
|
127
|
+
- ✅ Map
|
|
128
|
+
- ✅ Text
|
|
129
|
+
- ⬜ Tree
|
|
64
130
|
- ⬜ Studio (admin & developer panel)
|
|
65
131
|
|
|
66
|
-
|
|
132
|
+
## Runtimes
|
|
67
133
|
|
|
68
134
|
- ✅ [Cloudflare Workers](https://workers.cloudflare.com/)
|
|
135
|
+
- **WebSocket API**
|
|
136
|
+
- ✅ [Hibernation API](https://developers.cloudflare.com/durable-objects/best-practices/websockets/#websocket-hibernation-api) (default, recommended)
|
|
137
|
+
- ✅ [Standard API](https://developers.cloudflare.com/durable-objects/best-practices/websockets/#websocket-standard-api)
|
|
138
|
+
- **State Persistence**
|
|
139
|
+
- ✅ [SQLite-backed Durable Objects](https://developers.cloudflare.com/durable-objects/best-practices/access-durable-objects-storage/#create-sqlite-backed-durable-object-class) (default, recommended)
|
|
140
|
+
- ✅ [Key-value storage-backed Durable Object](https://developers.cloudflare.com/durable-objects/reference/durable-objects-migrations/#create-durable-object-class-with-key-value-storage)
|
|
69
141
|
- ✅ [Node.js](https://nodejs.org/)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
- ⬜ [Prisma](https://www.prisma.io/)
|
|
142
|
+
- ✅ **PubSubs**
|
|
143
|
+
- ✅ [Redis](https://redis.io/) (preview)
|
|
144
|
+
- ⬜ [MQTT](https://mqtt.org/)
|
|
145
|
+
- ✅ **State Persistence**
|
|
146
|
+
- ✅ In-memory (default)
|
|
147
|
+
- ✅ [Redis](https://redis.io/) (preview)
|
|
77
148
|
|
|
78
|
-
|
|
149
|
+
## Frontends Frameworks
|
|
79
150
|
|
|
80
151
|
- ✅ [React.js](https://react.dev/)
|
|
81
152
|
- ⬜ [Solid.js](https://www.solidjs.com/)
|
|
82
153
|
- ⬜ [Vue.js](https://vuejs.org/)
|
|
83
154
|
- ⬜ [Svelte](https://svelte.dev/)
|
|
84
155
|
|
|
85
|
-
##
|
|
86
|
-
|
|
87
|
-
Before diving into documentation, check out usage instructions for your selected platform:
|
|
88
|
-
|
|
89
|
-
### Documentation
|
|
90
|
-
|
|
91
|
-
Documentation is available at [pluv.io](https://pluv.io/docs/introduction).
|
|
92
|
-
|
|
93
|
-
## Related
|
|
156
|
+
## Packages
|
|
94
157
|
|
|
158
|
+
- [@pluv/io](https://www.npmjs.com/package/@pluv/io) - Server
|
|
95
159
|
- [@pluv/client](https://www.npmjs.com/package/@pluv/client) - Framework agnostic client
|
|
96
|
-
- [@pluv/
|
|
97
|
-
- [@pluv/
|
|
160
|
+
- [@pluv/react](https://www.npmjs.com/package/@pluv/react) - Integrate @pluv/client with React.js
|
|
161
|
+
- [@pluv/platform-pluv](https://www.npmjs.com/package/@pluv/platform-node) - Adapter to run on pluv.io
|
|
162
|
+
- [@pluv/platform-cloudflare](https://www.npmjs.com/package/@pluv/platform-cloudflare) - Adapter to run on Cloudflare Workers
|
|
163
|
+
- [@pluv/platform-node](https://www.npmjs.com/package/@pluv/platform-node) - Adapter to run on Node.js
|
|
164
|
+
- [@pluv/crdt-yjs](https://www.npmjs.com/package/@pluv/crdt-yjs) - Yjs CRDT adapter
|
|
165
|
+
- [@pluv/crdt-loro](https://www.npmjs.com/package/@pluv/crdt-loro) - Loro CRDT adapter
|
|
98
166
|
- [@pluv/persistence-redis](https://www.npmjs.com/package/@pluv/persistence-redis) - Persistence for storage on distributed systems (Node.js only)
|
|
99
|
-
- [@pluv/
|
|
100
|
-
- [@pluv/platform-node](https://www.npmjs.com/package/@pluv/platform-node) - Adapter to run @pluv/io on Node.js
|
|
167
|
+
- [@pluv/persistence-cloudflare-transactional-storage](https://www.npmjs.com/package/@pluv/persistence-cloudflare-transactional-storage) - Durable Object persistent state for WebSocket hibernation
|
|
101
168
|
- [@pluv/pubsub-redis](https://www.npmjs.com/package/@pluv/pubsub-redis) - PubSub for rooms across distributed systems
|
|
102
|
-
- [@pluv/react](https://www.npmjs.com/package/@pluv/react) - Integrate @pluv/client with React.js
|
|
103
169
|
|
|
104
170
|
## Credits
|
|
105
171
|
|
|
106
172
|
This software uses the following open source tooling and libraries:
|
|
107
173
|
|
|
108
|
-
- [Loro](https://loro.dev/)
|
|
109
|
-
- [Yjs](https://yjs.dev/)
|
|
110
|
-
- [Node.js](https://nodejs.org/)
|
|
111
174
|
- [Cloudflare Workers](https://workers.cloudflare.com/)
|
|
112
|
-
- [
|
|
175
|
+
- [Node.js](https://nodejs.org/)
|
|
113
176
|
- [React.js](https://reactjs.org/)
|
|
177
|
+
- [Yjs](https://yjs.dev/)
|
|
178
|
+
- [Loro](https://loro.dev/)
|
|
114
179
|
|
|
115
180
|
## License
|
|
116
181
|
|
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/io",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "@pluv/io server-side websocket manager",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
"jose": "^5.10.0",
|
|
22
22
|
"kleur": "^4.1.5",
|
|
23
23
|
"wonka": "^6.3.5",
|
|
24
|
-
"@pluv/crdt": "^0.
|
|
25
|
-
"@pluv/types": "^0.
|
|
24
|
+
"@pluv/crdt": "^1.0.0",
|
|
25
|
+
"@pluv/types": "^1.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"eslint": "^9.25.1",
|
|
29
29
|
"genversion": "^3.2.0",
|
|
30
30
|
"tsup": "^8.4.0",
|
|
31
31
|
"typescript": "^5.8.3",
|
|
32
|
-
"@pluv/tsconfig": "^0.
|
|
33
|
-
"eslint-config-pluv": "^0.
|
|
32
|
+
"@pluv/tsconfig": "^1.0.0",
|
|
33
|
+
"eslint-config-pluv": "^1.0.0"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "pnpm run version && tsup src/index.ts --format esm,cjs --dts",
|
package/src/version.generated.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '0.
|
|
2
|
+
export const version = '1.0.0'
|