summary refs log tree commit diff
diff options
context:
space:
mode:
authorJelle Licht <jlicht@fsfe.org>2023-02-08 22:05:18 +0100
committerJelle Licht <jlicht@fsfe.org>2023-05-06 13:53:21 +0200
commit14821580f5ce9d1e060fa7364e52281c355233a5 (patch)
tree54c47ed30a90f2ce011817fa378af999914e9785
parent7a44c34f4a709f56445c4029963cf5066971d3df (diff)
downloadguix-14821580f5ce9d1e060fa7364e52281c355233a5.tar.gz
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.
-rw-r--r--gnu/packages/node-xyz.scm26
1 files changed, 25 insertions, 1 deletions
diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index e3d8c7ca19..d75ccc199a 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