socket-function 0.31.0 → 0.33.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/SocketFunction.ts CHANGED
@@ -274,6 +274,16 @@ export class SocketFunction {
274
274
  return url.toString();
275
275
  }
276
276
 
277
+ private static ignoreExposeCount = 0;
278
+ public static async ignoreExposeCalls<T>(code: () => Promise<T>) {
279
+ this.ignoreExposeCount++;
280
+ try {
281
+ return await code();
282
+ } finally {
283
+ this.ignoreExposeCount--;
284
+ }
285
+ }
286
+
277
287
  /** Expose should be called before your mounting occurs. It mostly just exists to ensure you include the class type,
278
288
  * so the class type's module construction runs, which should trigger register. Otherwise you would have
279
289
  * to add additional imports to ensure the register call runs.
@@ -40,8 +40,6 @@ declare global {
40
40
  * - If not set for any files serverside, we will do nothing (and just leave old code running).
41
41
  */
42
42
  hotreload?: boolean;
43
- /** Only hotreloads the file in the browser. */
44
- hotreloadBrowser?: boolean;
45
43
  noserverhotreload?: boolean;
46
44
  }
47
45
  }
@@ -68,7 +66,7 @@ const hotReloadModule = cache((module: NodeJS.Module) => {
68
66
  if (!module.updateContents) return;
69
67
  let interval = 1000;
70
68
  let fast = false;
71
- if (module.hotreload || module.hotreloadBrowser) {
69
+ if (module.hotreload) {
72
70
  interval = 10;
73
71
  fast = true;
74
72
  }
@@ -150,7 +148,7 @@ class HotReloadControllerBase {
150
148
  document.location.reload();
151
149
  return;
152
150
  }
153
- if (!module.hotreload && !module.hotreloadBrowser) {
151
+ if (!module.hotreload) {
154
152
  console.log(`Module not hotreloadable: ${file}, reloading page to ensure new version is loaded`);
155
153
  document.location.reload();
156
154
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "socket-function",
3
- "version": "0.31.0",
3
+ "version": "0.33.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -12,7 +12,7 @@
12
12
  "node-forge": "https://github.com/sliftist/forge#name",
13
13
  "pako": "^2.1.0",
14
14
  "preact": "^10.10.6",
15
- "typenode": "^5.4.1",
15
+ "typenode": "^5.5.0",
16
16
  "ws": "^8.17.1"
17
17
  },
18
18
  "scripts": {
@@ -32,7 +32,7 @@ export async function performLocalCall(
32
32
  let classDef = classes[call.classGuid];
33
33
 
34
34
  if (!classDef) {
35
- throw new Error(`Class ${call.classGuid} not found`);
35
+ throw new Error(`Class ${call.classGuid} not found. Have ${Object.keys(classes).join(", ")}`);
36
36
  }
37
37
 
38
38
  if (!exposedClasses.has(call.classGuid)) {