From 5c98e5269a249e2b92ec14a7e62a4d57e6700801 Mon Sep 17 00:00:00 2001 From: Daniel Khodabakhsh Date: Tue, 24 Jun 2025 17:20:03 -0700 Subject: [PATCH] gnu: Add node-glob. * gnu/packages/node-xyz.scm (node-glob): New variable. Change-Id: I8a16ef870f604cac35cda534b49006c7f746895e Signed-off-by: Andreas Enge --- gnu/packages/node-xyz.scm | 58 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm index 407b62831c..a5097efe1c 100644 --- a/gnu/packages/node-xyz.scm +++ b/gnu/packages/node-xyz.scm @@ -792,6 +792,64 @@ URI to a file path. It accepts a @code{file:} URI and returns a file path suitable for use with the @code{fs} module functions.") (license license:expat))) +(define-public node-glob + (package + (name "node-glob") + (version "10.1.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/isaacs/node-glob") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 (base32 "19r0q9mxfbbma6z0iapf1jnccrz0hil69kihzbjjxzy9b7cgzmsd")))) + (build-system node-build-system) + (inputs (list + node-minimatch + node-minipass-5 + node-path-scurry)) + ; 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 'c8' and 'tap'. + #:phases #~(modify-phases %standard-phases + (add-before 'patch-dependencies 'modify-package + (lambda _ + (modify-json + (delete-dev-dependencies) + (delete-fields (list + "scripts.prepare")) + (delete-dependencies (list + ; Not currently used in other packages, but if there are + ; issues we may need to add this in. + "fs.realpath"))))) + (replace 'build + (lambda _ + (define output "output") + (for-each + (match-lambda ((format directory) + (invoke + "esbuild" + "src/*.ts" + "--platform=node" + (string-append "--format=" format) + "--target=es2022" + "--sourcemap" + (string-append "--outdir=" output "/dist/" directory)))) + (list (list "cjs" "cjs") (list "esm" "mjs"))) + (for-each + (lambda (file) (install-file file output)) + (list "LICENSE" "README.md" "package.json")) + (chdir output)))))) + (synopsis "Match files using the patterns the shell uses") + (description "The most correct and second fastest glob implementation in JavaScript.") + (home-page (git-reference-url (origin-uri source))) + (license license:isc))) + (define-public node-global-gradle-clean (package (name "node-global-gradle-clean")