@pluv/io 0.38.1 → 0.38.3
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 +9 -9
- package/CHANGELOG.md +16 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -1
- package/dist/index.mjs +14 -1
- package/package.json +5 -5
- package/src/PluvIO.ts +6 -0
- package/src/PluvRouter.ts +12 -0
- package/src/version.generated.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/io@0.38.
|
|
2
|
+
> @pluv/io@0.38.3 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.38.
|
|
6
|
+
> @pluv/io@0.38.3 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[
|
|
16
|
-
[32mCJS[39m ⚡️ Build success in
|
|
17
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
18
|
-
[32mESM[39m ⚡️ Build success in
|
|
15
|
+
[32mCJS[39m [1mdist/index.js [22m[32m46.46 KB[39m
|
|
16
|
+
[32mCJS[39m ⚡️ Build success in 132ms
|
|
17
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m44.29 KB[39m
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 139ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m30.
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m30.
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 2507ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m30.95 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m30.95 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @pluv/io
|
|
2
2
|
|
|
3
|
+
## 0.38.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8346273: Disallow the `# @pluv/io character in router event names.
|
|
8
|
+
- @pluv/crdt@0.38.3
|
|
9
|
+
- @pluv/types@0.38.3
|
|
10
|
+
|
|
11
|
+
## 0.38.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 039cd64: Require `PluvRouter` event names to be formatted as valid JavaScript variable names.
|
|
16
|
+
- @pluv/crdt@0.38.2
|
|
17
|
+
- @pluv/types@0.38.2
|
|
18
|
+
|
|
3
19
|
## 0.38.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -117,6 +117,7 @@ declare class PluvRouter<TPlatform extends AbstractPlatform<any> = AbstractPlatf
|
|
|
117
117
|
};
|
|
118
118
|
constructor(events: TEvents);
|
|
119
119
|
static merge<TRouters extends PluvRouter<any, any, any, any>[]>(...routers: TRouters): MergedRouter<TRouters>;
|
|
120
|
+
private _isValidEventName;
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
declare global {
|
package/dist/index.d.ts
CHANGED
|
@@ -117,6 +117,7 @@ declare class PluvRouter<TPlatform extends AbstractPlatform<any> = AbstractPlatf
|
|
|
117
117
|
};
|
|
118
118
|
constructor(events: TEvents);
|
|
119
119
|
static merge<TRouters extends PluvRouter<any, any, any, any>[]>(...routers: TRouters): MergedRouter<TRouters>;
|
|
120
|
+
private _isValidEventName;
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
declare global {
|
package/dist/index.js
CHANGED
|
@@ -377,12 +377,21 @@ var PluvProcedure = class _PluvProcedure {
|
|
|
377
377
|
var PluvRouter = class _PluvRouter {
|
|
378
378
|
constructor(events) {
|
|
379
379
|
this._defs = { events: {} };
|
|
380
|
+
const invalidName = Object.keys(events).find((name) => !this._isValidEventName(name));
|
|
381
|
+
if (typeof invalidName === "string") {
|
|
382
|
+
throw new Error(
|
|
383
|
+
`Invalid event name. Event names must be formatted as valid JavaScript variable names: "${invalidName}"`
|
|
384
|
+
);
|
|
385
|
+
}
|
|
380
386
|
this._defs = { events };
|
|
381
387
|
}
|
|
382
388
|
static merge(...routers) {
|
|
383
389
|
const events = Object.assign(/* @__PURE__ */ Object.create(null), ...routers.map((router) => router._defs.events));
|
|
384
390
|
return new _PluvRouter(events);
|
|
385
391
|
}
|
|
392
|
+
_isValidEventName(name) {
|
|
393
|
+
return /^[a-z_$][a-z0-9_$]*$/gi.test(name);
|
|
394
|
+
}
|
|
386
395
|
};
|
|
387
396
|
|
|
388
397
|
// src/PluvServer.ts
|
|
@@ -1000,7 +1009,7 @@ var IORoom = class {
|
|
|
1000
1009
|
};
|
|
1001
1010
|
|
|
1002
1011
|
// src/version.generated.ts
|
|
1003
|
-
var version = "0.38.
|
|
1012
|
+
var version = "0.38.3";
|
|
1004
1013
|
|
|
1005
1014
|
// src/PluvServer.ts
|
|
1006
1015
|
var PluvServer = class {
|
|
@@ -1241,6 +1250,10 @@ var PluvIO = class {
|
|
|
1241
1250
|
return PluvRouter.merge(...routers);
|
|
1242
1251
|
}
|
|
1243
1252
|
router(events) {
|
|
1253
|
+
const invalidName = Object.keys(events).find((name) => name.includes("$"));
|
|
1254
|
+
if (typeof invalidName === "string") {
|
|
1255
|
+
throw new Error(`Invalid event name. Event names must not contain $: "${invalidName}"`);
|
|
1256
|
+
}
|
|
1244
1257
|
return new PluvRouter(events);
|
|
1245
1258
|
}
|
|
1246
1259
|
server(config = {}) {
|
package/dist/index.mjs
CHANGED
|
@@ -335,12 +335,21 @@ var PluvProcedure = class _PluvProcedure {
|
|
|
335
335
|
var PluvRouter = class _PluvRouter {
|
|
336
336
|
constructor(events) {
|
|
337
337
|
this._defs = { events: {} };
|
|
338
|
+
const invalidName = Object.keys(events).find((name) => !this._isValidEventName(name));
|
|
339
|
+
if (typeof invalidName === "string") {
|
|
340
|
+
throw new Error(
|
|
341
|
+
`Invalid event name. Event names must be formatted as valid JavaScript variable names: "${invalidName}"`
|
|
342
|
+
);
|
|
343
|
+
}
|
|
338
344
|
this._defs = { events };
|
|
339
345
|
}
|
|
340
346
|
static merge(...routers) {
|
|
341
347
|
const events = Object.assign(/* @__PURE__ */ Object.create(null), ...routers.map((router) => router._defs.events));
|
|
342
348
|
return new _PluvRouter(events);
|
|
343
349
|
}
|
|
350
|
+
_isValidEventName(name) {
|
|
351
|
+
return /^[a-z_$][a-z0-9_$]*$/gi.test(name);
|
|
352
|
+
}
|
|
344
353
|
};
|
|
345
354
|
|
|
346
355
|
// src/PluvServer.ts
|
|
@@ -958,7 +967,7 @@ var IORoom = class {
|
|
|
958
967
|
};
|
|
959
968
|
|
|
960
969
|
// src/version.generated.ts
|
|
961
|
-
var version = "0.38.
|
|
970
|
+
var version = "0.38.3";
|
|
962
971
|
|
|
963
972
|
// src/PluvServer.ts
|
|
964
973
|
var PluvServer = class {
|
|
@@ -1199,6 +1208,10 @@ var PluvIO = class {
|
|
|
1199
1208
|
return PluvRouter.merge(...routers);
|
|
1200
1209
|
}
|
|
1201
1210
|
router(events) {
|
|
1211
|
+
const invalidName = Object.keys(events).find((name) => name.includes("$"));
|
|
1212
|
+
if (typeof invalidName === "string") {
|
|
1213
|
+
throw new Error(`Invalid event name. Event names must not contain $: "${invalidName}"`);
|
|
1214
|
+
}
|
|
1202
1215
|
return new PluvRouter(events);
|
|
1203
1216
|
}
|
|
1204
1217
|
server(config = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/io",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.3",
|
|
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.38.
|
|
25
|
-
"@pluv/types": "^0.38.
|
|
24
|
+
"@pluv/crdt": "^0.38.3",
|
|
25
|
+
"@pluv/types": "^0.38.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"eslint": "^8.57.1",
|
|
29
29
|
"genversion": "^3.2.0",
|
|
30
30
|
"tsup": "^8.4.0",
|
|
31
31
|
"typescript": "^5.8.2",
|
|
32
|
-
"@pluv/tsconfig": "^0.38.
|
|
33
|
-
"eslint-config-pluv": "^0.38.
|
|
32
|
+
"@pluv/tsconfig": "^0.38.3",
|
|
33
|
+
"eslint-config-pluv": "^0.38.3"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "pnpm run version && tsup src/index.ts --format esm,cjs --dts",
|
package/src/PluvIO.ts
CHANGED
|
@@ -106,6 +106,12 @@ export class PluvIO<
|
|
|
106
106
|
public router<TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>>(
|
|
107
107
|
events: TEvents,
|
|
108
108
|
): PluvRouter<TPlatform, TAuthorize, TContext, TEvents> {
|
|
109
|
+
const invalidName = Object.keys(events).find((name) => name.includes("$"));
|
|
110
|
+
|
|
111
|
+
if (typeof invalidName === "string") {
|
|
112
|
+
throw new Error(`Invalid event name. Event names must not contain $: "${invalidName}"`);
|
|
113
|
+
}
|
|
114
|
+
|
|
109
115
|
return new PluvRouter<TPlatform, TAuthorize, TContext, TEvents>(events);
|
|
110
116
|
}
|
|
111
117
|
|
package/src/PluvRouter.ts
CHANGED
|
@@ -32,6 +32,14 @@ export class PluvRouter<
|
|
|
32
32
|
readonly _defs: { events: TEvents } = { events: {} as TEvents };
|
|
33
33
|
|
|
34
34
|
constructor(events: TEvents) {
|
|
35
|
+
const invalidName = Object.keys(events).find((name) => !this._isValidEventName(name));
|
|
36
|
+
|
|
37
|
+
if (typeof invalidName === "string") {
|
|
38
|
+
throw new Error(
|
|
39
|
+
`Invalid event name. Event names must be formatted as valid JavaScript variable names: "${invalidName}"`,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
35
43
|
this._defs = { events };
|
|
36
44
|
}
|
|
37
45
|
|
|
@@ -42,4 +50,8 @@ export class PluvRouter<
|
|
|
42
50
|
|
|
43
51
|
return new PluvRouter<any, any, any, any>(events) as MergedRouter<TRouters>;
|
|
44
52
|
}
|
|
53
|
+
|
|
54
|
+
private _isValidEventName(name: string): boolean {
|
|
55
|
+
return /^[a-z_$][a-z0-9_$]*$/gi.test(name);
|
|
56
|
+
}
|
|
45
57
|
}
|
package/src/version.generated.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '0.38.
|
|
2
|
+
export const version = '0.38.3'
|