summaryrefslogtreecommitdiff
path: root/guix/build
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2023-10-06 13:13:47 +0200
committerRicardo Wurmus <rekado@elephly.net>2023-10-06 16:37:16 +0200
commit9d4339afb16af0f057b8a8afe8da443c33fb63e1 (patch)
tree5904e275b8d067e8f43462abbdccc3a6bf0860d1 /guix/build
parentb19dfb9d3a78d020cd1c5d94f60e22702bf9a1e9 (diff)
build-system/minify: Use esbuild.
* guix/build-system/minify.scm (default-uglify-js): Replace this procedure... (default-esbuild): ...with this new procedure. (lower): Use it, and add "esbuild" to build inputs. * guix/build/minify-build-system.scm (minify): Invoke esbuild instead of setting up a pipe to uglifyjs. * gnu/packages/cran.scm (r-shiny)[native-inputs]: Replace node-uglify-js with esbuild. * gnu/packages/statistics.scm (r-dt)[native-inputs]: Same.
Diffstat (limited to 'guix/build')
-rw-r--r--guix/build/minify-build-system.scm14
1 files changed, 4 insertions, 10 deletions
diff --git a/guix/build/minify-build-system.scm b/guix/build/minify-build-system.scm
index 5789ca3f0f..ea2428fa76 100644
--- a/guix/build/minify-build-system.scm
+++ b/guix/build/minify-build-system.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2016, 2023 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is part of GNU Guix.
@@ -24,7 +24,6 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (ice-9 match)
- #:use-module (ice-9 popen)
#:export (%standard-phases
minify-build
minify))
@@ -39,14 +38,9 @@
(define* (minify file #:key target (directory ""))
(format #t "minifying ~a\n" file)
(let* ((base (basename file ".js"))
- (installed (or target (string-append directory base ".min.js")))
- (minified (open-pipe* OPEN_READ "uglifyjs" file)))
- (call-with-output-file installed
- (cut dump-port minified <>))
- (match (close-pipe minified)
- (0 #t)
- (status
- (error "uglify-js failed" status)))))
+ (installed (or target (string-append directory base ".min.js"))))
+ (invoke "esbuild" file "--minify"
+ (string-append "--outfile=" installed))))
(define* (build #:key javascript-files
#:allow-other-keys)