mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
gnu: Add esbuild-node.
* gnu/packages/web.scm (esbuild-node): New variable. Change-Id: I5e1a353a13ef7b4018fcf4aef4832af25f3dabe2
This commit is contained in:
parent
9f9127e80a
commit
675d31a5df
1 changed files with 59 additions and 0 deletions
|
@ -2054,6 +2054,65 @@ (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)
|
||||
;; We're using Node 10, which doesn't have this method.
|
||||
(substitute* "scripts/esbuild.js"
|
||||
(("exports.buildNativeLib" m)
|
||||
(string-append
|
||||
"Object.fromEntries = entries => entries.reduce((result, entry) => (result[entry[0]] = entry[1], result), {});\n"
|
||||
m)))
|
||||
;; 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)))))
|
||||
|
||||
(define-public wwwoffle
|
||||
(package
|
||||
(name "wwwoffle")
|
||||
|
|
Loading…
Reference in a new issue