guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/16: gnu: node-acorn: Fix broken transpilation.


From: guix-commits
Subject: 03/16: gnu: node-acorn: Fix broken transpilation.
Date: Mon, 20 Feb 2023 11:03:04 -0500 (EST)

jlicht pushed a commit to branch node-18-updates
in repository guix.

commit 29ac5d4392b33f9ae4da298a552a4073a9213161
Author: Jelle Licht <jlicht@fsfe.org>
AuthorDate: Wed Feb 8 22:05:18 2023 +0100

    gnu: node-acorn: Fix broken transpilation.
    
    * gnu/packages/node-xyz.scm (node-acorn)[native-inputs]: Add `esbuild'.
    [arguments]<phases>: Replace build phase by custom `esbuild' invocations.
---
 gnu/packages/node-xyz.scm | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 5e7e6ae4d9..c9a853616e 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2021 Charles <charles.b.jackson@protonmail.com>
 ;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;; Copyright © 2022 Nicolas Graves <ngraves@ngraves.fr>
+;;; Copyright © 2023 Jelle Licht <jlicht@fsfe.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -75,7 +76,30 @@
                                                               #t))
                                                            scripts-alist)))
                                   (other other))
-                                pkg-meta-alist))))))))))
+                                pkg-meta-alist)))))))
+         (replace 'build
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (let ((esbuild (search-input-file (or native-inputs inputs)
+                                        "/bin/esbuild")))
+               (invoke esbuild
+                     "src/index.js"
+                     "--outfile=dist/acorn.js"
+                     "--format=cjs"
+                     "--bundle"
+                     "--platform=node")
+               (invoke esbuild
+                     "src/index.js"
+                     "--outfile=dist/acorn.mjs"
+                     "--format=esm"
+                     "--bundle"
+                     "--platform=node")
+               (invoke esbuild
+                     "src/bin/acorn.js"
+                     "--outfile=dist/bin.js"
+                     "--format=cjs"
+                     "--platform=node")))))))
+    (native-inputs
+     (list esbuild))
     (home-page "https://github.com/acornjs/acorn/tree/master/acorn";)
     (synopsis "Javascript-based Javascript parser")
     (description "Acornjs is a Javascript parser with many options and an



reply via email to

[Prev in Thread] Current Thread [Next in Thread]