@j0hanz/superfetch 2.4.3 → 2.4.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.
package/dist/config.d.ts CHANGED
@@ -48,6 +48,7 @@ export declare const config: {
48
48
  metadataFormat: TransformMetadataFormat;
49
49
  };
50
50
  tools: {
51
+ enabled: string[];
51
52
  timeoutMs: number;
52
53
  };
53
54
  cache: {
package/dist/config.js CHANGED
@@ -204,6 +204,7 @@ export const config = {
204
204
  metadataFormat: parseTransformMetadataFormat(process.env.TRANSFORM_METADATA_FORMAT),
205
205
  },
206
206
  tools: {
207
+ enabled: parseList(process.env.ENABLED_TOOLS ?? 'fetch-url'),
207
208
  timeoutMs: parseInteger(process.env.TOOL_TIMEOUT_MS, DEFAULT_TOOL_TIMEOUT_MS, 1000, 300000),
208
209
  },
209
210
  cache: {
package/dist/crypto.js CHANGED
@@ -6,12 +6,13 @@ const ALLOWED_HASH_ALGORITHMS = new Set([
6
6
  ]);
7
7
  function byteLength(input) {
8
8
  return typeof input === 'string'
9
- ? Buffer.byteLength(input, 'utf8')
9
+ ? new TextEncoder().encode(input).length
10
10
  : input.byteLength;
11
11
  }
12
12
  export function timingSafeEqualUtf8(a, b) {
13
- const aBuffer = Buffer.from(a, 'utf8');
14
- const bBuffer = Buffer.from(b, 'utf8');
13
+ const encoder = new TextEncoder();
14
+ const aBuffer = encoder.encode(a);
15
+ const bBuffer = encoder.encode(b);
15
16
  if (aBuffer.length !== bBuffer.length)
16
17
  return false;
17
18
  return timingSafeEqual(aBuffer, bBuffer);