socket-function 0.12.4 → 0.12.5

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.
@@ -63,7 +63,7 @@ const hotReloadModule = cache((module: NodeJS.Module) => {
63
63
  let interval = 1000;
64
64
  let fast = false;
65
65
  if (module.hotreload || module.hotreloadBrowser) {
66
- interval = 50;
66
+ interval = 10;
67
67
  fast = true;
68
68
  }
69
69
  fs.watchFile(module.filename, { persistent: false, interval }, (curr, prev) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "socket-function",
3
- "version": "0.12.4",
3
+ "version": "0.12.5",
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",
@@ -107,8 +107,17 @@ class RequireControllerBase {
107
107
  result = result.replace(BEFORE_ENTRY_TEMPLATE, beforeEntryText.join("\n"));
108
108
  }
109
109
  if (requireCalls) {
110
- result = result.replace(ENTRY_TEMPLATE, `<script>\n${requireCalls.map(x => `require(${JSON.stringify(x)});`).join(" \n")
111
- }</script>`);
110
+ async function requireAll(calls: string[]) {
111
+ for (let call of calls) {
112
+ try {
113
+ await require(call);
114
+ } catch (e) {
115
+ // Detach the error so we can continue
116
+ setTimeout(() => { throw e; });
117
+ }
118
+ }
119
+ }
120
+ result = result.replace(ENTRY_TEMPLATE, `<script>\n(${requireAll.toString()})(${JSON.stringify(requireCalls)});\n</script>`);
112
121
  }
113
122
  return setHTTPResultHeaders(Buffer.from(result), { "Content-Type": "text/html" });
114
123
  }