summaryrefslogtreecommitdiff
path: root/gnu/packages/javascript.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/javascript.scm')
-rw-r--r--gnu/packages/javascript.scm65
1 files changed, 53 insertions, 12 deletions
diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
index a54d4ecabd..3a9e88ad08 100644
--- a/gnu/packages/javascript.scm
+++ b/gnu/packages/javascript.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2018 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -60,10 +61,10 @@
%build-inputs))
(let ((install-directory (string-append %output "/share/fonts/mathjax")))
(mkdir-p install-directory)
- (zero? (system* "tar" "-C" install-directory "-xvf"
- (assoc-ref %build-inputs "source")
- ,(string-append "MathJax-" version "/fonts")
- "--strip" "2"))))))
+ (invoke "tar" "-C" install-directory "-xvf"
+ (assoc-ref %build-inputs "source")
+ ,(string-append "MathJax-" version "/fonts")
+ "--strip" "2")))))
(native-inputs
`(("gzip" ,gzip)
("tar" ,tar)))
@@ -94,10 +95,10 @@
(list (assoc-ref %build-inputs "glibc-utf8-locales")))
(setenv "LANG" "en_US.UTF-8")
(let ((install-directory (string-append %output "/share/javascript/mathjax")))
- (system* "tar" "xvf" (assoc-ref %build-inputs "source")
- ,(string-append "MathJax-" (package-version font-mathjax)
- "/unpacked")
- "--strip" "2")
+ (invoke "tar" "xvf" (assoc-ref %build-inputs "source")
+ ,(string-append "MathJax-" (package-version font-mathjax)
+ "/unpacked")
+ "--strip" "2")
(mkdir-p install-directory)
(symlink (string-append (assoc-ref %build-inputs "font-mathjax")
"/share/fonts/mathjax")
@@ -118,7 +119,9 @@
(dump-port minified port)))))
(else
(install-file file (dirname installed))))))
- (find-files "."))))))
+ (find-files "."))
+
+ #t))))
(native-inputs
`(("font-mathjax" ,font-mathjax)
("glibc-utf8-locales" ,glibc-utf8-locales)
@@ -159,9 +162,9 @@ be able to view it naturally and easily.")))
%build-inputs))
(let ((install-directory (string-append %output
"/share/javascript/respond/")))
- (system* "tar" "xvf"
- (assoc-ref %build-inputs "source")
- "--strip" "1")
+ (invoke "tar" "xvf"
+ (assoc-ref %build-inputs "source")
+ "--strip" "1")
(mkdir-p install-directory)
(let* ((file "src/respond.js")
(installed (string-append install-directory "respond.min.js")))
@@ -368,6 +371,44 @@ to ES5 without causing run-time errors in older engines. In many cases, this
means that these shams cause many ES5 methods to silently fail.")
(license license:expat)))
+(define-public js-filesaver
+ (package
+ (name "js-filesaver")
+ (version "1.3.8")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://github.com/eligrey/FileSaver.js/"
+ "archive/" version ".tar.gz"))
+ (file-name (string-append name "-" version))
+ (sha256
+ (base32
+ "1rkhfqs5plaj628kzj7qgm5qahy4v7ihygifidqr6g6265mil97h"))))
+ (build-system minify-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'fix-uglification
+ ;; Remove "export" keyword which prevents the file from being
+ ;; uglified by uglify-js. Moreover, that keyword is not present in
+ ;; the minified version of the library some projects are using,
+ ;; e.g.,
+ ;; <https://github.com/jmoenig/Snap--Build-Your-Own-Blocks/blob/master/FileSaver.min.js>
+ (lambda _
+ (substitute* "src/FileSaver.js"
+ (("export ") ""))
+ #t)))))
+ (home-page
+ "https://eligrey.com/blog/saving-generated-files-on-the-client-side/")
+ (synopsis "HTML5 saveAs() FileSaver implementation")
+ (description "@file{FileSaver.js} implements the @code{saveAs()}
+FileSaver interface in browsers that do not natively support it.
+
+@file{FileSaver.js} is the solution to saving files on the
+client-side, and is perfect for webapps that need to generate files,
+or for saving sensitive information that shouldn't be sent to an
+external server.")
+ (license license:expat)))
+
(define-public mujs
(package
(name "mujs")