From d0b5815b57fff2e226a7191829c8aedf23552b36 Mon Sep 17 00:00:00 2001 Message-ID: From: Daniel Khodabakhsh Date: Mon, 30 Dec 2024 01:29:11 -0800 Subject: [PATCH] Bump esbuild to 0.23.0 and fix node module. 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 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 ;;; Copyright © 2024 Marco Baggio ;;; Copyright © 2024 Spencer King +;;; Copyright © 2024 Daniel Khodabakhsh ;;; ;;; 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 ;;; Copyright © 2022 Nicolas Graves ;;; Copyright © 2023 Jelle Licht +;;; Copyright © 2024 Daniel Khodabakhsh ;;; ;;; 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 +;;; Copyright © 2024 Daniel Khodabakhsh ;;; ;;; 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