summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/node.scm5
-rw-r--r--gnu/packages/patches/llhttp-ponyfill-object-fromentries.patch46
3 files changed, 50 insertions, 2 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index eb2447ca6f..9e192f1e4f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1828,6 +1828,7 @@ dist_patch_DATA = \
%D%/packages/patches/libmemcached-build-with-gcc7.patch \
%D%/packages/patches/libmhash-hmac-fix-uaf.patch \
%D%/packages/patches/llama-cpp-vulkan-optional.patch \
+ %D%/packages/patches/llhttp-ponyfill-object-fromentries.patch \
%D%/packages/patches/lvm2-no-systemd.patch \
%D%/packages/patches/maturin-no-cross-compile.patch \
%D%/packages/patches/mecab-variable-param.patch \
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 20acffb3df..6c0031aa5a 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -679,7 +679,7 @@ parser definition into a C output.")
(define-public llhttp-bootstrap
(package
(name "llhttp")
- (version "8.1.2")
+ (version "9.2.1")
(source (origin
(method git-fetch)
(uri (git-reference
@@ -688,7 +688,8 @@ parser definition into a C output.")
(file-name (git-file-name name version))
(sha256
(base32
- "1808y8mpdcmsi8rxndilngg4nn2fbqfgb29f47kk9mmdpqg5s17r"))
+ "0mzg19aqb1am498gms0z75cwd5kmfg9p78b1hhxw67019nsjcbac"))
+ (patches (search-patches "llhttp-ponyfill-object-fromentries.patch"))
(modules '((guix build utils)))
(snippet
'(begin
diff --git a/gnu/packages/patches/llhttp-ponyfill-object-fromentries.patch b/gnu/packages/patches/llhttp-ponyfill-object-fromentries.patch
new file mode 100644
index 0000000000..16ac6b45f6
--- /dev/null
+++ b/gnu/packages/patches/llhttp-ponyfill-object-fromentries.patch
@@ -0,0 +1,46 @@
+diff --git a/src/llhttp/constants.ts b/src/llhttp/constants.ts
+index 226342e..1a4c93a 100644
+--- a/src/llhttp/constants.ts
++++ b/src/llhttp/constants.ts
+@@ -1,4 +1,4 @@
+-import { enumToMap } from './utils';
++import { enumToMap, fromEntries } from './utils';
+
+ export type IntDict = Record<string, number>;
+
+@@ -328,7 +328,7 @@ export const METHODS_RTSP = [
+
+ export const METHOD_MAP = enumToMap(METHODS);
+
+-export const H_METHOD_MAP = Object.fromEntries(
++export const H_METHOD_MAP = fromEntries(
+ Object.entries(METHODS).filter(([ k ]) => k.startsWith('H'))
+ );
+
+diff --git a/src/llhttp/utils.ts b/src/llhttp/utils.ts
+index 2251125..5ac4aeb 100644
+--- a/src/llhttp/utils.ts
++++ b/src/llhttp/utils.ts
+@@ -1,5 +1,13 @@
+ import { IntDict } from './constants';
+
++/*! fromentries. MIT License. Copyright (c) 2018-2020 Feross Aboukhadijeh */
++export function fromEntries (iterable) {
++ return [...iterable].reduce((obj, [key, val]) => {
++ obj[key] = val
++ return obj
++ }, {})
++}
++
+ export function enumToMap(
+ obj: IntDict,
+ filter: ReadonlyArray<number> = [],
+@@ -8,7 +16,7 @@ export function enumToMap(
+ const emptyFilter = (filter?.length ?? 0) === 0;
+ const emptyExceptions = (exceptions?.length ?? 0) === 0;
+
+- return Object.fromEntries(Object.entries(obj).filter(([ , value ]) => {
++ return fromEntries(Object.entries(obj).filter(([ , value ]) => {
+ return (
+ typeof value === 'number' &&
+ (emptyFilter || filter.includes(value)) && \ No newline at end of file