@pluv/client 0.38.1 → 0.38.2

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @pluv/client@0.38.1 build /home/runner/work/pluv/pluv/packages/client
2
+ > @pluv/client@0.38.2 build /home/runner/work/pluv/pluv/packages/client
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,11 +8,11 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- CJS dist/index.js 48.91 KB
12
- CJS ⚡️ Build success in 115ms
13
- ESM dist/index.mjs 47.59 KB
14
- ESM ⚡️ Build success in 129ms
11
+ CJS dist/index.js 49.27 KB
12
+ CJS ⚡️ Build success in 92ms
13
+ ESM dist/index.mjs 47.95 KB
14
+ ESM ⚡️ Build success in 93ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 3357ms
17
- DTS dist/index.d.mts 23.13 KB
18
- DTS dist/index.d.ts 23.13 KB
16
+ DTS ⚡️ Build success in 3285ms
17
+ DTS dist/index.d.mts 23.16 KB
18
+ DTS dist/index.d.ts 23.16 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @pluv/client
2
2
 
3
+ ## 0.38.2
4
+
5
+ ### Patch Changes
6
+
7
+ - de35f0b: Require `PluvRouter` event names to be formatted as valid JavaScript variable names.
8
+ - @pluv/crdt@0.38.2
9
+ - @pluv/types@0.38.2
10
+
3
11
  ## 0.38.1
4
12
 
5
13
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -86,6 +86,7 @@ declare class PluvRouter<TIO extends IOLike = IOLike, TPresence extends JsonObje
86
86
  };
87
87
  constructor(events: TEvents);
88
88
  static merge<TRouters extends PluvRouter<any, any, any, any>[]>(...routers: TRouters): MergedRouter<TRouters>;
89
+ private _isValidEventName;
89
90
  }
90
91
 
91
92
  interface StateNotifierSubjects<TIO extends IOLike, TPresence extends JsonObject> {
package/dist/index.d.ts CHANGED
@@ -86,6 +86,7 @@ declare class PluvRouter<TIO extends IOLike = IOLike, TPresence extends JsonObje
86
86
  };
87
87
  constructor(events: TEvents);
88
88
  static merge<TRouters extends PluvRouter<any, any, any, any>[]>(...routers: TRouters): MergedRouter<TRouters>;
89
+ private _isValidEventName;
89
90
  }
90
91
 
91
92
  interface StateNotifierSubjects<TIO extends IOLike, TPresence extends JsonObject> {
package/dist/index.js CHANGED
@@ -249,6 +249,12 @@ var OtherNotifier = class {
249
249
  var PluvRouter = class _PluvRouter {
250
250
  constructor(events) {
251
251
  this._defs = { events: {} };
252
+ const invalidName = Object.keys(events).find((name) => !this._isValidEventName(name));
253
+ if (typeof invalidName === "string") {
254
+ throw new Error(
255
+ `Invalid event name. Event names must be formatted as valid JavaScript variable names: "${invalidName}"`
256
+ );
257
+ }
252
258
  this._defs = { events };
253
259
  }
254
260
  static merge(...routers) {
@@ -258,6 +264,9 @@ var PluvRouter = class _PluvRouter {
258
264
  }
259
265
  return new _PluvRouter(events);
260
266
  }
267
+ _isValidEventName(name) {
268
+ return /^[a-z_$][a-z0-9_$]*$/gi.test(name);
269
+ }
261
270
  };
262
271
 
263
272
  // src/StateNotifier.ts
package/dist/index.mjs CHANGED
@@ -218,6 +218,12 @@ var OtherNotifier = class {
218
218
  var PluvRouter = class _PluvRouter {
219
219
  constructor(events) {
220
220
  this._defs = { events: {} };
221
+ const invalidName = Object.keys(events).find((name) => !this._isValidEventName(name));
222
+ if (typeof invalidName === "string") {
223
+ throw new Error(
224
+ `Invalid event name. Event names must be formatted as valid JavaScript variable names: "${invalidName}"`
225
+ );
226
+ }
221
227
  this._defs = { events };
222
228
  }
223
229
  static merge(...routers) {
@@ -227,6 +233,9 @@ var PluvRouter = class _PluvRouter {
227
233
  }
228
234
  return new _PluvRouter(events);
229
235
  }
236
+ _isValidEventName(name) {
237
+ return /^[a-z_$][a-z0-9_$]*$/gi.test(name);
238
+ }
230
239
  };
231
240
 
232
241
  // src/StateNotifier.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/client",
3
- "version": "0.38.1",
3
+ "version": "0.38.2",
4
4
  "description": "@pluv/io frontend client",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -18,15 +18,15 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "wonka": "^6.3.5",
21
- "@pluv/crdt": "^0.38.1",
22
- "@pluv/types": "^0.38.1"
21
+ "@pluv/crdt": "^0.38.2",
22
+ "@pluv/types": "^0.38.2"
23
23
  },
24
24
  "devDependencies": {
25
25
  "eslint": "^8.57.1",
26
26
  "tsup": "^8.4.0",
27
27
  "typescript": "^5.8.2",
28
- "@pluv/tsconfig": "^0.38.1",
29
- "eslint-config-pluv": "^0.38.1"
28
+ "@pluv/tsconfig": "^0.38.2",
29
+ "eslint-config-pluv": "^0.38.2"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsup src/index.ts --format esm,cjs --dts",
package/src/PluvRouter.ts CHANGED
@@ -53,6 +53,14 @@ export class PluvRouter<
53
53
  readonly _defs: { events: TEvents } = { events: {} as TEvents };
54
54
 
55
55
  constructor(events: TEvents) {
56
+ const invalidName = Object.keys(events).find((name) => !this._isValidEventName(name));
57
+
58
+ if (typeof invalidName === "string") {
59
+ throw new Error(
60
+ `Invalid event name. Event names must be formatted as valid JavaScript variable names: "${invalidName}"`,
61
+ );
62
+ }
63
+
56
64
  this._defs = { events };
57
65
  }
58
66
 
@@ -67,4 +75,8 @@ export class PluvRouter<
67
75
 
68
76
  return new PluvRouter<any, any, any, any>(events) as MergedRouter<TRouters>;
69
77
  }
78
+
79
+ private _isValidEventName(name: string): boolean {
80
+ return /^[a-z_$][a-z0-9_$]*$/gi.test(name);
81
+ }
70
82
  }