[PATCH] Bump esbuild to 0.23.0 and fix node module

  • Open
  • quality assurance status badge
Details
2 participants
  • Daniel Khodabakhsh
  • Sharlatan Hellseher
Owner
unassigned
Submitted by
Daniel Khodabakhsh
Severity
normal

Debbugs page

Daniel Khodabakhsh wrote 3 months ago
(address . guix-patches@gnu.org)
CAADuFn+i-a+UZVnqQDF-HZs+p+K9Fcc72XBV+sF_oRPiP26M6Q@mail.gmail.com
Bump esbuild to 0.23.0.
Also fix the current definition of esbuild-node by renaming it to node-esbuild,
moving it to gnu/packages/node-xyz.scm and using the appropriate build-system.

Signed-off-by: Daniel Khodabakhsh <d.khodabakhsh@gmail.com>
Change-Id: Idb7236362d6e488283222c734a4a096e869d6d2c
---
gnu/packages/cran.scm | 4 ++-
gnu/packages/node-xyz.scm | 57 ++++++++++++++++++++++++++++++++++++++
gnu/packages/web.scm | 58 ++-------------------------------------
3 files changed, 63 insertions(+), 56 deletions(-)

Toggle diff (200 lines)
diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm
index aa18931d92..99d14d7b65 100644
--- a/gnu/packages/cran.scm
+++ b/gnu/packages/cran.scm
@@ -39,6 +39,7 @@
;;; Copyright © 2022 Greg Hogan <code@greghogan.com>
;;; Copyright © 2024 Marco Baggio <guix@mawumag.com>
;;; Copyright © 2024 Spencer King <spencer.king@geneoscopy.com>
+;;; Copyright © 2024 Daniel Khodabakhsh <d.khodabakhsh@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -97,6 +98,7 @@ (define-module (gnu packages cran)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages networking)
#:use-module (gnu packages node)
+ #:use-module (gnu packages node-xyz)
#:use-module (gnu packages pcre)
#:use-module (gnu packages pdf)
#:use-module (gnu packages perl)
@@ -2648,7 +2650,7 @@ (define-public r-waiter
"inst/assets/garcon/garcon.min.js"))))))
(propagated-inputs (list r-htmltools r-r6 r-shiny))
(native-inputs
- (list esbuild-node node-lts r-knitr
+ (list node-esbuild node-lts r-knitr
(origin
(method git-fetch)
(uri (git-reference
diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index e98eda2a01..c11b76495d 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2021 Dhruvin Gandhi <contact@dhruvin.dev>
;;; Copyright © 2022 Nicolas Graves <ngraves@ngraves.fr>
;;; Copyright © 2023 Jelle Licht <jlicht@fsfe.org>
+;;; Copyright © 2024 Daniel Khodabakhsh <d.khodabakhsh@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -376,6 +377,62 @@ (define-public node-env-variable
@code{localStorage} fallbacks.")
(license license:expat)))

+(define-public node-esbuild
+ (package
+ (name "node-esbuild")
+ (version "0.23.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/evanw/esbuild")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "03014924aaksw5hm8h5j6d7v28vgyqbhhfcn4lfw12fg8bj1hzh0"))))
+ (build-system node-build-system)
+ (inputs (list esbuild))
+ (arguments `(
+ #:tests? #f
+ #:modules
+ ((guix build node-build-system)
+ (srfi srfi-1)
+ (ice-9 match)
+ (guix build utils))
+ #:phases (modify-phases %standard-phases
+ (add-after 'unpack 'chdir (lambda _
+ (chdir "npm/esbuild")))
+ (replace 'build (lambda* (#:key inputs #:allow-other-keys)
+ (let
+ ((esbuild-bin
+ (string-append (assoc-ref inputs "esbuild") "/bin/esbuild")))
+ (invoke
+ "node"
+ "../../scripts/esbuild.js"
+ esbuild-bin
+ "--neutral")
+ ; TODO: Once 74900 is merged, replace below with:
+ ; (modify-json (delete-fields '("optionalDependencies",
"scripts")))
+ (with-atomic-json-file-replacement "package.json"
+ (match-lambda
+ ((@ . pkg-meta-alist)
+ (cons '@ (filter
+ (match-lambda
+ (("optionalDependencies" . _) #f)
+ (("scripts" . _) #f)
+ (_ #t))
+ pkg-meta-alist)))))
+ (delete-file "install.js")
+ (delete-file "package-lock.json")
+ (copy-file esbuild-bin "bin/esbuild")))))))
+ (home-page "https://esbuild.github.io/")
+ (synopsis "Node module of ESBuild")
+ (description
+ "The esbuild tool provides a unified bundler, transpiler and
+minifier. It packages up JavaScript and TypeScript code, along with JSON
+and other data, for distribution on the web.")
+ (license license:expat)))
+
(define-public node-far
(package
(name "node-far")
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index b278239c7d..cd427483cc 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -68,6 +68,7 @@
;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz>
;;; Copyright © 2024 Zheng Junjie <873216071@qq.com>
;;; Copyright © 2024 Artyom V. Poptsov <poptsov.artyom@gmail.com>
+;;; Copyright © 2024 Daniel Khodabakhsh <d.khodabakhsh@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1950,7 +1951,7 @@ (define-public libpsl
(define-public esbuild
(package
(name "esbuild")
- (version "0.14.0")
+ (version "0.23.0")
(source
(origin
(method git-fetch)
@@ -1959,7 +1960,7 @@ (define-public esbuild
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
- (base32 "09r1xy0kk6c9cpz6q0mxr4why373pwxbm439z2ihq3k1d5kk7x4w"))
+ (base32 "03014924aaksw5hm8h5j6d7v28vgyqbhhfcn4lfw12fg8bj1hzh0"))
(modules '((guix build utils)))
(snippet
'(begin
@@ -2099,59 +2100,6 @@ (define-public websockify
directions.")
(license license:lgpl3)))

-;; This is a variant of esbuild that builds and installs the nodejs API.
-;; Eventually, this should probably be merged with the esbuild package.
-(define-public esbuild-node
- (package
- (inherit esbuild)
- (name "esbuild-node")
- (version (package-version esbuild))
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/evanw/esbuild")
- (commit (string-append "v" version))))
- (file-name (git-file-name name version))
- (sha256
- (base32 "09r1xy0kk6c9cpz6q0mxr4why373pwxbm439z2ihq3k1d5kk7x4w"))
- (modules '((guix build utils)))
- (snippet
- ;; Remove prebuilt binaries
- '(delete-file-recursively "lib/npm/exit0"))))
- (arguments
- (list
- #:import-path "github.com/evanw/esbuild/cmd/esbuild"
- #:unpack-path "github.com/evanw/esbuild"
- #:phases
- #~(modify-phases %standard-phases
- (add-after 'build 'build-platform
- (lambda* (#:key unpack-path #:allow-other-keys)
- (with-directory-excursion (string-append "src/" unpack-path)
- ;; Must be writable.
- (for-each make-file-writable (find-files "." "."))
- (invoke "node" "scripts/esbuild.js"
- (string-append #$output "/bin/esbuild"))
- (let ((modules (string-append #$output
"/lib/node_modules/esbuild")))
- (mkdir-p modules)
- (copy-recursively "npm/esbuild" modules)))))
- (replace 'check
- (lambda* (#:key tests? unpack-path #:allow-other-keys)
- (when tests?
- ;; The "Go Race Detector" is only supported on 64-bit
- ;; platforms, this variable disables it.
- ;; TODO: Causes too many rebuilds, rewrite to limit to x86_64,
- ;; aarch64 and ppc64le.
- #$(if (target-riscv64?)
- `(setenv "ESBUILD_RACE" "")
- #~(unless #$(target-64bit?)
- (setenv "ESBUILD_RACE" "")))
- (with-directory-excursion (string-append "src/" unpack-path)
- (invoke "make" "test-go"))))))))
- (native-inputs
- (modify-inputs (package-native-inputs esbuild)
- (append node-lts)))))
-
(define-public wwwoffle
(package
(name "wwwoffle")

base-commit: e16cdcf37d8223b3634ec5e658356c3b7f154859
--
2.46.0
Sharlatan Hellseher wrote 1 months ago
(address . 75190@debbugs.gnu.org)(address . jlicht@fsfe.org)(address . d.khodabakhsh@gmail.com)
CAO+9K5qf2_CvhrBxcbgJtW5ET=b0jTgucegymsBKAo9fxdsnRw@mail.gmail.com
Hi,

#74900 is merged on JavaScript team branch and esbuild is
refreshed from go-team and in master already, I think this patch
needs to be adjusted.

Looking forward for V2.

Oleg
Attachment: file
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 75190@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 75190
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help