* [bug#66371] [PATCH] build-system/minify: Use esbuild.
@ 2023-10-06 13:05 Ricardo Wurmus
2023-10-06 20:32 ` bug#66371: " Ricardo Wurmus
0 siblings, 1 reply; 2+ messages in thread
From: Ricardo Wurmus @ 2023-10-06 13:05 UTC (permalink / raw)
To: 66371; +Cc: Ricardo Wurmus, Ricardo Wurmus
* 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.
---
gnu/packages/cran.scm | 2 +-
gnu/packages/statistics.scm | 2 +-
guix/build-system/minify.scm | 12 ++++++------
guix/build/minify-build-system.scm | 14 ++++----------
4 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm
index 3e72a082ec..af5749b0d0 100644
--- a/gnu/packages/cran.scm
+++ b/gnu/packages/cran.scm
@@ -4591,7 +4591,7 @@ (define-public r-shiny
(inputs
(list js-datatables js-selectize js-strftime js-highlight))
(native-inputs
- `(("uglifyjs" ,node-uglify-js)
+ `(("esbuild" ,esbuild)
("gfortran" ,gfortran)
("js-bootstrap-accessibility"
,(origin
diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index 61eec5ecd9..aa2094ecdb 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -4069,7 +4069,7 @@ (define-public r-dt
(list js-selectize))
(native-inputs
`(("r-knitr" ,r-knitr)
- ("uglifyjs" ,node-uglify-js)
+ ("esbuild" ,esbuild)
("datatables-plugins"
,(let ((version "1.13.4"))
(origin
diff --git a/guix/build-system/minify.scm b/guix/build-system/minify.scm
index 787235deeb..b377b506b5 100644
--- a/guix/build-system/minify.scm
+++ b/guix/build-system/minify.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2017, 2018, 2023 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
@@ -41,15 +41,15 @@ (define %minify-build-system-modules
`((guix build minify-build-system)
,@%gnu-build-system-modules))
-(define (default-uglify-js)
+(define (default-esbuild)
"Return the default package to minify JavaScript source files."
;; Lazily resolve the binding to avoid a circular dependency.
- (let ((mod (resolve-interface '(gnu packages uglifyjs))))
- (module-ref mod 'uglifyjs)))
+ (let ((mod (resolve-interface '(gnu packages web))))
+ (module-ref mod 'esbuild)))
(define* (lower name
#:key source inputs native-inputs outputs system
- (uglify-js (default-uglify-js))
+ (esbuild (default-esbuild))
#:allow-other-keys
#:rest arguments)
"Return a bag for NAME."
@@ -64,7 +64,7 @@ (define* (lower name
'())
,@inputs
,@(standard-packages)))
- (build-inputs `(("uglify-js" ,uglify-js)
+ (build-inputs `(("esbuild" ,esbuild)
,@native-inputs))
(outputs outputs)
(build minify-build)
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 @@ (define-module (guix build minify-build-system)
#: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-module (guix build minify-build-system)
(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)
base-commit: 8d27ef1ed34a0a7fe14fd76f31541b62d0125498
prerequisite-patch-id: c5d3a52f7522a8f71a15b1d8c0a63c0d24fde78f
--
2.41.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#66371: [PATCH] build-system/minify: Use esbuild.
2023-10-06 13:05 [bug#66371] [PATCH] build-system/minify: Use esbuild Ricardo Wurmus
@ 2023-10-06 20:32 ` Ricardo Wurmus
0 siblings, 0 replies; 2+ messages in thread
From: Ricardo Wurmus @ 2023-10-06 20:32 UTC (permalink / raw)
To: 66371-done
Ricardo Wurmus <rekado@elephly.net> writes:
> * 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.
I pushed this. There were no new build failures.
--
Ricardo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-06 20:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-06 13:05 [bug#66371] [PATCH] build-system/minify: Use esbuild Ricardo Wurmus
2023-10-06 20:32 ` bug#66371: " Ricardo Wurmus
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).