summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorDaniel Khodabakhsh <d@niel.khodabakh.sh>2025-06-24 08:37:21 -0700
committerAndreas Enge <andreas@enge.fr>2026-01-27 10:39:44 +0100
commitbde545386f64d65b2c63d6f6b7f613dbf3c69be2 (patch)
tree84100b8d675d507957fc0cbb3f20c277c42113a2 /gnu
parent333f7c170939dc1cde074e9adba008ceb4bd95d6 (diff)
gnu: Add node-lru-cache.
* gnu/packages/node-xyz.scm (node-lru-cache): New variable. Change-Id: Ic09c6608d11554d0e67935dab87a0f681d1ca49b Signed-off-by: Andreas Enge <andreas@enge.fr>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/node-xyz.scm60
1 files changed, 60 insertions, 0 deletions
diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 8640c0daf74..2396ee9e5a0 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -597,6 +597,66 @@ such as rainbows.")
user-land JavaScript.")
(license license:expat))) ; in README
+(define-public node-lru-cache
+ (package
+ (name "node-lru-cache")
+ (version "10.4.3")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/isaacs/node-lru-cache")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256 (base32 "1zqpm7d7czbqyymzgs4qadd0hiy6n290y6wwy1gwa46mmd1bxbr3"))))
+ (build-system node-build-system)
+ ; Use ESBuild instead of tshy because this is used to build Typescript.
+ (native-inputs (list esbuild))
+ (arguments (list
+ #:modules '(
+ (guix build node-build-system)
+ (guix build utils)
+ (ice-9 match))
+ #:tests? #f ; FIXME: Tests require 'tap'.
+ #:phases #~(modify-phases %standard-phases
+ (add-before 'patch-dependencies 'delete-dependencies
+ (lambda _
+ (modify-json
+ (delete-dev-dependencies)
+ (delete-fields (list
+ "scripts.prepare")))))
+ (replace 'build
+ (lambda _
+ (define output "output")
+ (for-each
+ (match-lambda ((format directory type)
+ (define target-output (string-append output "/dist/" directory))
+ (invoke
+ "esbuild"
+ "src/*.ts"
+ "--platform=node"
+ "--target=es2022"
+ (string-append "--format=" format)
+ "--jsx=transform"
+ "--sourcemap"
+ (string-append "--outdir=" target-output))
+ (with-output-to-file
+ (string-append target-output "/package.json")
+ (lambda _
+ (display (string-append "{\"type\": \"" type "\"}"))))))
+ (list
+ (list "cjs" "commonjs" "commonjs")
+ (list "esm" "esm" "module")))
+ (for-each
+ (lambda (file) (install-file file output))
+ (list "LICENSE" "package.json" "README.md"))
+ (chdir output))))))
+ (synopsis "A fast cache that automatically deletes the least recently used items.")
+ (description "A cache object that deletes the least-recently-used items.
+Specify a max number of the most recently used items that you want to keep, and
+this cache will keep that many of the most recently accessed items.")
+ (home-page (git-reference-url (origin-uri source)))
+ (license license:isc)))
+
(define-public node-mersenne
(package
(name "node-mersenne")