socket-function 0.10.5 → 0.10.6

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
@@ -39,7 +39,7 @@ export class SocketFunction {
39
39
 
40
40
  public static MAX_MESSAGE_SIZE = 1024 * 1024 * 32;
41
41
 
42
- public static httpETagCache = false;
42
+ public static HTTP_ETAG_CACHE = false;
43
43
  public static silent = true;
44
44
 
45
45
  public static HTTP_COMPRESS = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "socket-function",
3
- "version": "0.10.5",
3
+ "version": "0.10.6",
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",
@@ -277,6 +277,7 @@ class RequireControllerBase {
277
277
  modules: Object.entries(result.modules).map(x => [x[0], {
278
278
  filename: x[1].filename,
279
279
  version: x[1].version,
280
+ sourceLength: x[1].source?.length,
280
281
  }]),
281
282
  };
282
283
  let key = sha256Hash(JSON.stringify(simplifiedResult));
@@ -166,7 +166,7 @@ export async function httpCallHandler(request: http.IncomingMessage, response: h
166
166
 
167
167
  // NOTE: Our ETag caching is only to reduce data sent on the wire, we evaluate the calls
168
168
  // every time (so it is strictly a wire cache for HTTP, not a computation cache)
169
- if (SocketFunction.httpETagCache) {
169
+ if (SocketFunction.HTTP_ETAG_CACHE) {
170
170
  response.setHeader("cache-control", "private, max-age=0, must-revalidate");
171
171
  let hash = sha256Hash(resultBuffer);
172
172
  response.setHeader("ETag", hash);
@@ -5,14 +5,16 @@ function ansiHSL(h: number, s: number, l: number, text: string): string {
5
5
  return ansiRGB(r, g, b, text);
6
6
  }
7
7
  function ansiRGB(r: number, g: number, b: number, text: string): string {
8
- return `\x1b[38;2;${r};${g};${b}m${text}\x1b[39m`;
8
+ return `\x1b[38;2;${r};${g};${b}m${text}\x1b[0m`;
9
9
  }
10
10
 
11
11
  const lightness = 68;
12
- export const blue = ansiHSL.bind(null, 235, 100, lightness);
12
+ export const blue = (text: string) => `\x1b[34m${text}\x1b[0m`;
13
13
  export const red = ansiHSL.bind(null, 0, 100, lightness);
14
- export const green = (text: string) => `\x1b[32m${text}\x1b[39m`; // chalk.hsl(120, 100, lightness).bind(chalk);
15
- export const yellow = (text: string) => `\x1b[33m${text}\x1b[39m`;
14
+ export const green = (text: string) => `\x1b[32m${text}\x1b[0m`;
15
+ export const yellow = (text: string) => `\x1b[33m${text}\x1b[0m`;
16
16
  export const white = ansiHSL.bind(null, 0, 0, 80);
17
17
 
18
- export const magenta = (text: string) => `\x1b[35m${text}\x1b[39m`;
18
+ export const magenta = (text: string) => `\x1b[35m${text}\x1b[0m`;
19
+
20
+ console.log(blue('blue'));