GNU bug report logs - #75190
[PATCH] Bump esbuild to 0.23.0 and fix node module

Previous Next

Package: guix-patches;

Reported by: Daniel Khodabakhsh <d.khodabakhsh <at> gmail.com>

Date: Mon, 30 Dec 2024 09:38:02 UTC

Severity: normal

Tags: patch

Done: Daniel Khodabakhsh <d.khodabakhsh <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 75190 in the body.
You can then email your comments to 75190 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#75190; Package guix-patches. (Mon, 30 Dec 2024 09:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Khodabakhsh <d.khodabakhsh <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 30 Dec 2024 09:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Daniel Khodabakhsh <d.khodabakhsh <at> gmail.com>
To: guix-patches <at> gnu.org
Subject: [PATCH] Bump esbuild to 0.23.0 and fix node module
Date: Mon, 30 Dec 2024 09:36:51 +0000
[Message part 1 (text/plain, inline)]
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 <at> 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(-)

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 <at> greghogan.com>
 ;;; Copyright © 2024 Marco Baggio <guix <at> mawumag.com>
 ;;; Copyright © 2024 Spencer King <spencer.king <at> geneoscopy.com>
+;;; Copyright © 2024 Daniel Khodabakhsh <d.khodabakhsh <at> 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 <at> dhruvin.dev>
 ;;; Copyright © 2022 Nicolas Graves <ngraves <at> ngraves.fr>
 ;;; Copyright © 2023 Jelle Licht <jlicht <at> fsfe.org>
+;;; Copyright © 2024 Daniel Khodabakhsh <d.khodabakhsh <at> 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 <at> qq.com>
 ;;; Copyright © 2024 Artyom V. Poptsov <poptsov.artyom <at> gmail.com>
+;;; Copyright © 2024 Daniel Khodabakhsh <d.khodabakhsh <at> 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
[0001-Bump-esbuild-to-0.23.0.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#75190; Package guix-patches. (Tue, 18 Feb 2025 11:27:02 GMT) Full text and rfc822 format available.

Message #8 received at 75190 <at> debbugs.gnu.org (full text, mbox):

From: Sharlatan Hellseher <sharlatanus <at> gmail.com>
To: 75190 <at> debbugs.gnu.org
Cc: jlicht <at> fsfe.org, d.khodabakhsh <at> gmail.com
Subject: [PATCH] Bump esbuild to 0.23.0 and fix node module
Date: Tue, 18 Feb 2025 11:26:28 +0000
[Message part 1 (text/plain, inline)]
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
[Message part 2 (text/html, inline)]

Reply sent to Daniel Khodabakhsh <d.khodabakhsh <at> gmail.com>:
You have taken responsibility. (Thu, 01 May 2025 17:21:02 GMT) Full text and rfc822 format available.

Notification sent to Daniel Khodabakhsh <d.khodabakhsh <at> gmail.com>:
bug acknowledged by developer. (Thu, 01 May 2025 17:21:02 GMT) Full text and rfc822 format available.

Message #13 received at 75190-done <at> debbugs.gnu.org (full text, mbox):

From: Daniel Khodabakhsh <d.khodabakhsh <at> gmail.com>
To: 75190-done <at> debbugs.gnu.org
Date: Thu, 1 May 2025 17:20:09 +0000
Hi Oleg!

Yes you're right. I've also rethought the approach: this one combined
version bumping and refactoring esbuild-node. I'm going to close this
one and create a new patch. Just did that now and here is the new
patch: #78183




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 30 May 2025 11:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 33 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.