socket-function 0.49.0 → 0.51.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "socket-function",
3
- "version": "0.49.0",
3
+ "version": "0.51.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",
@@ -225,7 +225,7 @@ class RequireControllerBase {
225
225
  seqNum: module.requireControllerSeqNum,
226
226
  size: module.size,
227
227
  version: module.version,
228
- asyncRequests: module.asyncRequires,
228
+ asyncRequests: module.asyncRequires || {},
229
229
  flags: {},
230
230
  };
231
231
  for (let [flag, value] of Object.entries(module)) {
@@ -256,7 +256,7 @@ class RequireControllerBase {
256
256
  if (requiredModule) {
257
257
  // Only include synchronous modules. BUT, DO include the requests, so when/if the request is made
258
258
  // it can be resolved correctly.
259
- if (!module.asyncRequires[request]) {
259
+ if (!module.asyncRequires?.[request]) {
260
260
  addModule(requiredModule);
261
261
  }
262
262
  moduleObj.requests[request] = requiredModule.filename;
@@ -144,7 +144,12 @@ export const runClientHooks = measureWrap(async function runClientHooks(
144
144
  }
145
145
  }
146
146
  for (let hook of clientHooks) {
147
+ let time = Date.now();
147
148
  await hook(context);
149
+ time = Date.now() - time;
150
+ if (time > 100) {
151
+ console.warn(`Slow client hook: ${JSON.stringify(hook.name || hook.toString().slice(0, 100))} took ${time}ms`);
152
+ }
148
153
  // NOTE: See ClientHookContext.overrideResult for why we break here
149
154
  if ("overrideResult" in context) {
150
155
  break;