javascript.scm 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
  3. ;;; Copyright © 2017, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
  4. ;;; Copyright © 2017, 2018, 2020, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
  5. ;;; Copyright © 2017, 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
  6. ;;; Copyright © 2018 Nicolas Goaziou <mail@nicolasgoaziou.fr>
  7. ;;; Copyright © 2021 Pierre Neidhardt <mail@ambrevar.xyz>
  8. ;;;
  9. ;;; This file is part of GNU Guix.
  10. ;;;
  11. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  12. ;;; under the terms of the GNU General Public License as published by
  13. ;;; the Free Software Foundation; either version 3 of the License, or (at
  14. ;;; your option) any later version.
  15. ;;;
  16. ;;; GNU Guix is distributed in the hope that it will be useful, but
  17. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. ;;; GNU General Public License for more details.
  20. ;;;
  21. ;;; You should have received a copy of the GNU General Public License
  22. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  23. (define-module (gnu packages javascript)
  24. #:use-module ((guix licenses) #:prefix license:)
  25. #:use-module (gnu packages)
  26. #:use-module (gnu packages base)
  27. #:use-module (gnu packages compression)
  28. #:use-module (gnu packages lisp-xyz)
  29. #:use-module (gnu packages readline)
  30. #:use-module (gnu packages web)
  31. #:use-module (guix packages)
  32. #:use-module (guix download)
  33. #:use-module (guix git-download)
  34. #:use-module (guix build-system gnu)
  35. #:use-module (guix build-system cmake)
  36. #:use-module (guix build-system trivial)
  37. #:use-module (guix build-system minify)
  38. #:use-module (guix utils))
  39. (define-public cjson
  40. (package
  41. (name "cjson")
  42. (version "1.7.15")
  43. (source (origin
  44. (method git-fetch)
  45. (uri (git-reference
  46. (url "https://github.com/DaveGamble/cJSON")
  47. (commit (string-append "v" version))))
  48. (file-name (git-file-name name version))
  49. (sha256
  50. (base32 "0lmq7sx09rmsirimbyvaaia44i134ppkp10cw1d2rygr76k9qwq2"))))
  51. (build-system cmake-build-system)
  52. (arguments
  53. `(#:configure-flags '("-DENABLE_CJSON_UTILS=On")))
  54. (home-page "https://github.com/DaveGamble/cJSON")
  55. (synopsis "JSON parser written in ANSI C")
  56. (description "This library provides a portable embeddable JSON parser.")
  57. (license license:expat)))
  58. (define-public js-context-menu
  59. (package
  60. (name "js-context-menu")
  61. (version "0.6.1")
  62. (source
  63. (origin
  64. (method git-fetch)
  65. (uri (git-reference
  66. (url "https://github.com/zorkow/context-menu")
  67. (commit (string-append "v" version))))
  68. (file-name (git-file-name name version))
  69. (sha256
  70. (base32
  71. "1q063l6477z285j6h5wvccp6iswvlp0jmb96sgk32sh0lf7nhknh"))))
  72. (build-system trivial-build-system)
  73. (arguments
  74. `(#:modules ((guix build utils))
  75. #:builder
  76. (begin
  77. (use-modules (guix build utils))
  78. (chdir (assoc-ref %build-inputs "source"))
  79. (let ((target (string-append %output "/share/javascript/context-menu")))
  80. (apply invoke (string-append (assoc-ref %build-inputs "esbuild")
  81. "/bin/esbuild")
  82. "--bundle"
  83. "--tsconfig=tsconfig.json"
  84. (string-append "--outdir=" target)
  85. (find-files "ts" "\\.ts$"))))))
  86. (native-inputs
  87. `(("esbuild" ,esbuild)))
  88. (home-page "https://github.com/zorkow/context-menu")
  89. (synopsis "Generic context menu")
  90. (description "This package provides a reimplementation of the MathJax
  91. context menu in TypeScript.")
  92. (license license:asl2.0)))
  93. (define-public font-mathjax
  94. (package
  95. (name "font-mathjax")
  96. (version "2.7.2")
  97. (source
  98. (origin
  99. (method git-fetch)
  100. (uri (git-reference
  101. (url "https://github.com/mathjax/MathJax")
  102. (commit version)))
  103. (file-name (git-file-name name version))
  104. (sha256
  105. (base32
  106. "127j12g7v2hx6k7r00b8cp49s7nkrwhxy6l8p03pw34xpxbgbimm"))))
  107. (build-system trivial-build-system)
  108. (arguments
  109. `(#:modules ((guix build utils))
  110. #:builder
  111. (begin
  112. (use-modules (guix build utils)
  113. (ice-9 match))
  114. (let ((install-directory (string-append %output "/share/fonts/mathjax")))
  115. (mkdir-p install-directory)
  116. (copy-recursively (string-append (assoc-ref %build-inputs "source")
  117. "/fonts")
  118. install-directory)))))
  119. (home-page "https://www.mathjax.org/")
  120. (synopsis "Fonts for MathJax")
  121. (description "This package contains the fonts required for MathJax.")
  122. (license license:asl2.0)))
  123. (define-public js-mathjax
  124. (package
  125. (inherit font-mathjax)
  126. (name "js-mathjax")
  127. (arguments
  128. `(#:modules ((guix build utils))
  129. #:builder
  130. (begin
  131. (use-modules (guix build utils)
  132. (ice-9 match)
  133. (ice-9 popen)
  134. (ice-9 regex))
  135. (set-path-environment-variable
  136. "PATH" '("bin") (map (match-lambda
  137. ((_ . input)
  138. input))
  139. %build-inputs))
  140. (set-path-environment-variable
  141. "GUIX_LOCPATH" '("lib/locale")
  142. (list (assoc-ref %build-inputs "glibc-utf8-locales")))
  143. (setenv "LANG" "en_US.UTF-8")
  144. (let ((install-directory (string-append %output "/share/javascript/mathjax")))
  145. (copy-recursively (string-append (assoc-ref %build-inputs "source") "/unpacked")
  146. "MathJax-unpacked")
  147. (mkdir-p install-directory)
  148. (symlink (string-append (assoc-ref %build-inputs "font-mathjax")
  149. "/share/fonts/mathjax")
  150. (string-append install-directory "/fonts"))
  151. (for-each
  152. (lambda (file)
  153. (let ((installed (string-append install-directory
  154. ;; remove prefix "./MathJax-unpacked"
  155. (string-drop file 18))))
  156. (format #t "~a -> ~a~%" file installed)
  157. (cond
  158. ((string-match "\\.js$" file)
  159. (mkdir-p (dirname installed))
  160. (let ((minified (open-pipe* OPEN_READ "uglify-js" file)))
  161. (call-with-output-file installed
  162. (lambda (port)
  163. (dump-port minified port)))
  164. (let ((exit (close-pipe minified)))
  165. (unless (zero? exit)
  166. (error "dear, uglify-js failed" exit)))))
  167. (else
  168. (install-file file (dirname installed))))))
  169. (find-files "."))
  170. #t))))
  171. (native-inputs
  172. `(("font-mathjax" ,font-mathjax)
  173. ("glibc-utf8-locales" ,glibc-utf8-locales)
  174. ("uglify-js" ,uglify-js)
  175. ,@(package-native-inputs font-mathjax)))
  176. (synopsis "JavaScript display engine for LaTeX, MathML, and AsciiMath")
  177. (description "MathJax is a JavaScript display engine for LaTeX, MathML,
  178. and AsciiMath notation that works in all modern browsers. It requires no
  179. plugins or software to be installed on the browser. So the page author can
  180. write web documents that include mathematics and be confident that readers will
  181. be able to view it naturally and easily.")))
  182. (define-public js-commander
  183. (package
  184. (name "js-commander")
  185. (version "6.2.1")
  186. (source
  187. (origin
  188. (method git-fetch)
  189. (uri (git-reference
  190. (url "https://github.com/tj/commander.js")
  191. (commit (string-append "v" version))))
  192. (file-name (git-file-name name version))
  193. (sha256
  194. (base32
  195. "126m25s6mxpxmdj4aw5awz06b47r8r798lcf1c5bnmmh39cik5i1"))))
  196. (build-system trivial-build-system)
  197. (arguments
  198. `(#:modules ((guix build utils))
  199. #:builder
  200. (begin
  201. (use-modules (guix build utils))
  202. (chdir (assoc-ref %build-inputs "source"))
  203. (let ((esbuild (string-append (assoc-ref %build-inputs "esbuild")
  204. "/bin/esbuild"))
  205. (target (string-append %output "/share/javascript/commander")))
  206. (invoke esbuild
  207. "--bundle"
  208. "--minify"
  209. "--tsconfig=tsconfig.json"
  210. "--platform=node"
  211. (string-append "--outfile=" target "/index.min.js")
  212. "index.js")))))
  213. (native-inputs
  214. `(("esbuild" ,esbuild)))
  215. (home-page "https://github.com/tj/commander.js")
  216. (synopsis "Library for node.js command-line interfaces")
  217. (description "Commander.js aims to be the complete solution for node.js
  218. command-line interfaces. ")
  219. (license license:expat)))
  220. (define-public js-xmldom-sre
  221. ;; This commit corresponds to the untagged release 0.1.32
  222. (let ((commit "3c79325bc2c9e5d27e3ba44b680fa8c5dd6a381d")
  223. (revision "1"))
  224. (package
  225. (name "js-xmldom-sre")
  226. (version "0.1.32")
  227. (source
  228. (origin
  229. (method git-fetch)
  230. (uri (git-reference
  231. (url "https://github.com/zorkow/xmldom/")
  232. (commit commit)))
  233. (file-name (git-file-name name version))
  234. (sha256
  235. (base32
  236. "0a88v0id3mjflpvjqhv8a28br0xvaaszxbf7alg6pxfbnkb69yyq"))))
  237. (build-system trivial-build-system)
  238. (arguments
  239. `(#:modules ((guix build utils))
  240. #:builder
  241. (begin
  242. (use-modules (guix build utils))
  243. (chdir (assoc-ref %build-inputs "source"))
  244. (let ((esbuild (string-append (assoc-ref %build-inputs "esbuild")
  245. "/bin/esbuild"))
  246. (target (string-append %output "/share/javascript/xmldom-sre")))
  247. (invoke esbuild
  248. "--bundle"
  249. "--minify"
  250. "--platform=node"
  251. (string-append "--outfile=" target "/dom-parser.min.js")
  252. "dom-parser.js")))))
  253. (native-inputs
  254. `(("esbuild" ,esbuild)))
  255. (home-page "https://github.com/zorkow/xmldom/")
  256. (synopsis "DOM parser and XML serializer")
  257. (description "This is a fork of the xmldom library. It allows the use
  258. of wicked-good-xpath together with xmldom.")
  259. ;; One of these licenses may be selected.
  260. (license (list license:expat
  261. license:lgpl2.0)))))
  262. (define-public js-respond
  263. (package
  264. (name "js-respond")
  265. (version "1.4.2")
  266. (source (origin
  267. (method git-fetch)
  268. (uri (git-reference
  269. (url "https://github.com/scottjehl/Respond")
  270. (commit version)))
  271. (file-name (git-file-name name version))
  272. (sha256
  273. (base32
  274. "00xid731rirc7sdy1gc8qal3v9g0agr2qx15hm4x97l1lcbylyn2"))))
  275. (build-system minify-build-system)
  276. (arguments
  277. `(#:javascript-files '("src/matchmedia.addListener.js"
  278. "src/matchmedia.polyfill.js"
  279. "src/respond.js")))
  280. (home-page "https://github.com/scottjehl/Respond")
  281. (synopsis "Polyfill for min/max-width CSS3 Media Queries")
  282. (description "The goal of this script is to provide a fast and lightweight
  283. script to enable responsive web designs in browsers that don't support CSS3
  284. Media Queries.")
  285. (license license:expat)))
  286. (define-public js-html5shiv
  287. (package
  288. (name "js-html5shiv")
  289. (version "3.7.3")
  290. (source (origin
  291. (method git-fetch)
  292. (uri (git-reference
  293. (url "https://github.com/aFarkas/html5shiv")
  294. (commit version)))
  295. (file-name (git-file-name name version))
  296. (sha256
  297. (base32
  298. "0y1c5nyq0brl9fjdihhax33vks4s1ij9iv113879sg3zflmgqpd0"))))
  299. (build-system minify-build-system)
  300. (home-page "https://github.com/aFarkas/html5shiv")
  301. (synopsis "Enable HTML5 sectioning elements in legacy browsers")
  302. (description "The HTML5 Shiv enables use of HTML5 sectioning elements in
  303. legacy Internet Explorer and provides basic HTML5 styling for Internet
  304. Explorer 6-9, Safari 4.x (and iPhone 3.x), and Firefox 3.x.")
  305. ;; From the file "MIT and GPL2 licenses.md":
  306. ;;
  307. ;; This software is licensed under a dual license system (MIT or GPL
  308. ;; version 2). This means you are free to choose with which of both
  309. ;; licenses (MIT or GPL version 2) you want to use this library.
  310. (license (list license:expat license:gpl2))))
  311. (define-public js-json2
  312. (let ((commit "031b1d9e6971bd4c433ca85e216cc853f5a867bd")
  313. (revision "1"))
  314. (package
  315. (name "js-json2")
  316. (version (string-append "2016-10-28." revision "-" (string-take commit 7)))
  317. (source (origin
  318. (method git-fetch)
  319. (uri (git-reference
  320. (url "https://github.com/douglascrockford/JSON-js")
  321. (commit commit)))
  322. (file-name (string-append name "-" version "-checkout"))
  323. (sha256
  324. (base32
  325. "1fvb6b2y5sd3sqdgcj683sdxcbxdii34q0ysc9wg0dq1sy81l11v"))))
  326. (build-system minify-build-system)
  327. (arguments
  328. `(#:javascript-files '("json2.js"
  329. "json_parse.js"
  330. "json_parse_state.js"
  331. "cycle.js")))
  332. (home-page "https://github.com/douglascrockford/JSON-js")
  333. (synopsis "JSON encoders and decoders")
  334. (description "The files in this collection implement JSON
  335. encoders/decoders in JavaScript.
  336. @code{json2.js}: This file creates a JSON property in the global object, if
  337. there isn't already one, setting its value to an object containing a stringify
  338. method and a parse method. The @code{parse} method uses the @code{eval}
  339. method to do the parsing, guarding it with several regular expressions to
  340. defend against accidental code execution hazards. On current browsers, this
  341. file does nothing, preferring the built-in JSON object.
  342. @code{json_parse.js}: This file contains an alternative JSON @code{parse}
  343. function that uses recursive descent instead of @code{eval}.
  344. @code{json_parse_state.js}: This files contains an alternative JSON
  345. @code{parse} function that uses a state machine instead of @code{eval}.
  346. @code{cycle.js}: This file contains two functions, @code{JSON.decycle} and
  347. @code{JSON.retrocycle}, which make it possible to encode cyclical structures
  348. and DAGs in JSON, and to then recover them. This is a capability that is not
  349. provided by ES5. @code{JSONPath} is used to represent the links.")
  350. (license license:public-domain))))
  351. (define-public js-strftime
  352. (package
  353. (name "js-strftime")
  354. (version "0.10.0")
  355. (source (origin
  356. (method git-fetch)
  357. (uri (git-reference
  358. (url"https://github.com/samsonjs/strftime")
  359. (commit (string-append "v" version))))
  360. (file-name (git-file-name name version))
  361. (sha256
  362. (base32
  363. "131nmlivazwxyba25kh9lda99749fq4xsyin6lzfalaaydviby4p"))))
  364. (build-system minify-build-system)
  365. (arguments
  366. `(#:javascript-files '("strftime.js")))
  367. (home-page "https://github.com/samsonjs/strftime")
  368. (synopsis "Implementation of strftime to JavaScript")
  369. (description "This is an implementation of the @code{strftime} procedure
  370. for JavaScript. It works in (at least) node.js and browsers. It supports
  371. localization and timezones. Most standard specifiers from C are supported as
  372. well as some other extensions from Ruby.")
  373. (license license:expat)))
  374. (define-public js-highlight
  375. (package
  376. (name "js-highlight")
  377. (version "9.12.0")
  378. (source (origin
  379. (method git-fetch)
  380. (uri (git-reference
  381. (url "https://github.com/isagalaev/highlight.js")
  382. (commit version)))
  383. (file-name (git-file-name name version))
  384. (sha256
  385. (base32
  386. "12qz22qjpd6svj58pwgcwg2x2rzhihfdrxg6lgj39nfpaln6dris"))))
  387. (build-system minify-build-system)
  388. (arguments
  389. `(#:javascript-files '("src/highlight.js")))
  390. (home-page "https://github.com/isagalaev/highlight.js")
  391. (synopsis "Syntax highlighting for JavaScript")
  392. (description "Highlight.js is a syntax highlighter written in JavaScript.
  393. It works in the browser as well as on the server. It works with pretty much
  394. any markup, doesn’t depend on any framework and has automatic language
  395. detection.")
  396. (license license:bsd-3)))
  397. (define-public js-datatables
  398. (package
  399. (name "js-datatables")
  400. (version "1.10.19")
  401. (source (origin
  402. (method url-fetch)
  403. (uri (string-append "https://datatables.net/releases/DataTables-"
  404. version ".zip"))
  405. (sha256
  406. (base32
  407. "0cff8a1g7pjwbjdqq0yzqd963ar7pfi4splmm6rwdzganr77rkhb"))))
  408. (build-system minify-build-system)
  409. (arguments
  410. `(#:javascript-files '("media/js/dataTables.bootstrap.js"
  411. "media/js/jquery.dataTables.js")))
  412. (native-inputs
  413. `(("unzip" ,unzip)))
  414. (home-page "https://datatables.net")
  415. (synopsis "DataTables plug-in for jQuery")
  416. (description "DataTables is a table enhancing plug-in for the jQuery
  417. Javascript library, adding sorting, paging and filtering abilities to plain
  418. HTML tables with minimal effort.")
  419. (license license:expat)))
  420. (define-public js-requirejs
  421. (package
  422. (name "js-requirejs")
  423. (version "2.3.6")
  424. (source (origin
  425. (method git-fetch)
  426. (uri (git-reference
  427. (url "https://github.com/requirejs/requirejs")
  428. (commit version)))
  429. (file-name (git-file-name name version))
  430. (sha256
  431. (base32
  432. "0cvd5y2mb3h6yil3niqn3gjqrzixdsxcz4rvc2f0hg4kzp5y0w86"))))
  433. (build-system minify-build-system)
  434. (arguments `(#:javascript-files '("require.js")))
  435. (home-page "https://github.com/requirejs/requirejs/")
  436. (synopsis "File and module loader for JavaScript")
  437. (description "RequireJS loads plain JavaScript files as well as more
  438. defined modules. It is optimized for in-browser use, including in a Web
  439. Worker, but it can be used in other JavaScript environments.")
  440. (license license:expat)))
  441. (define-public js-selectize
  442. (package
  443. (name "js-selectize")
  444. (version "0.12.6")
  445. (source (origin
  446. (method git-fetch)
  447. (uri (git-reference
  448. (url "https://github.com/selectize/selectize.js")
  449. (commit (string-append "v" version))))
  450. (file-name (git-file-name name version))
  451. (sha256
  452. (base32
  453. "15gichl8wi6yxag2ps723nxrgyan15976dzsnvw9h9py8sbyyzjn"))))
  454. (build-system minify-build-system)
  455. (arguments `(#:javascript-files '("src/selectize.js")))
  456. (home-page "https://selectize.github.io/selectize.js/")
  457. (synopsis "Hybrid widget between a textbox and <select> box")
  458. (description "Selectize is the hybrid of a textbox and @code{<select>}
  459. box. It's jQuery based and it has autocomplete and native-feeling keyboard
  460. navigation; it is useful for tagging, contact lists, etc.")
  461. (license license:asl2.0)))
  462. (define-public js-es5-shim
  463. (package
  464. (name "js-es5-shim")
  465. (version "4.5.13")
  466. (source (origin
  467. (method git-fetch)
  468. (uri (git-reference
  469. (url "https://github.com/es-shims/es5-shim")
  470. (commit (string-append "v" version))))
  471. (file-name (git-file-name name version))
  472. (sha256
  473. (base32
  474. "142w384fbyllq4yggv173g82lw3wix4jqcg6hkhx1ymq89vvnpmh"))))
  475. (build-system minify-build-system)
  476. (arguments `(#:javascript-files
  477. '("es5-sham.js"
  478. "es5-shim.js")))
  479. (home-page "https://github.com/es-shims/es5-shim")
  480. (synopsis "ECMAScript 5 compatibility shims for legacy JavaScript engines")
  481. (description "@code{es5-shim.js} patches a JavaScript context to contain
  482. all ECMAScript 5 methods that can be faithfully emulated with a legacy
  483. JavaScript engine. @code{es5-sham.js} patches other ES5 methods as closely as
  484. possible. Many of these shams are intended only to allow code to be written
  485. to ES5 without causing run-time errors in older engines. In many cases, this
  486. means that these shams cause many ES5 methods to silently fail.")
  487. (license license:expat)))
  488. (define-public js-filesaver
  489. (package
  490. (name "js-filesaver")
  491. (version "1.3.8")
  492. (source (origin
  493. (method git-fetch)
  494. (uri (git-reference
  495. (url "https://github.com/eligrey/FileSaver.js")
  496. (commit version)))
  497. (file-name (git-file-name name version))
  498. (sha256
  499. (base32
  500. "0gvqk0hnr8fig0n4da7vj7q6z31bcyv52916xz3rbmdj3pgpiv1d"))))
  501. (build-system minify-build-system)
  502. (arguments
  503. `(#:phases
  504. (modify-phases %standard-phases
  505. (add-after 'unpack 'fix-uglification
  506. ;; Remove "export" keyword which prevents the file from being
  507. ;; uglified by uglify-js. Moreover, that keyword is not present in
  508. ;; the minified version of the library some projects are using,
  509. ;; e.g.,
  510. ;; <https://github.com/jmoenig/Snap--Build-Your-Own-Blocks/blob/master/FileSaver.min.js>
  511. (lambda _
  512. (substitute* "src/FileSaver.js"
  513. (("export ") ""))
  514. #t))
  515. (add-after 'install 'install-unminified-version
  516. (lambda* (#:key outputs #:allow-other-keys)
  517. (install-file "src/FileSaver.js"
  518. (string-append (assoc-ref outputs "out")
  519. "/share/javascript"))
  520. #t)))))
  521. (home-page
  522. "https://eligrey.com/blog/saving-generated-files-on-the-client-side/")
  523. (synopsis "HTML5 saveAs() FileSaver implementation")
  524. (description "@file{FileSaver.js} implements the @code{saveAs()}
  525. FileSaver interface in browsers that do not natively support it.
  526. @file{FileSaver.js} is the solution to saving files on the
  527. client-side, and is perfect for webapps that need to generate files,
  528. or for saving sensitive information that shouldn't be sent to an
  529. external server.")
  530. (license license:expat)))
  531. (define-public mujs
  532. (package
  533. (name "mujs")
  534. (version "1.1.1")
  535. (source
  536. (origin
  537. (method git-fetch)
  538. (uri (git-reference
  539. (url "https://github.com/ccxvii/mujs")
  540. (commit version)))
  541. (file-name (git-file-name name version))
  542. (sha256
  543. (base32 "0ivqz06fq8v36p2gkjh64vgv0gm7nghds0n42vrv7vm46phdffvb"))))
  544. (build-system gnu-build-system)
  545. (arguments
  546. `(#:phases
  547. (modify-phases %standard-phases
  548. (delete 'configure) ; no configure script
  549. (replace 'install
  550. (lambda* (#:key (make-flags '()) #:allow-other-keys)
  551. (apply invoke "make" "install-shared" make-flags))))
  552. #:make-flags
  553. (list ,(string-append "VERSION=" version)
  554. ,(string-append "CC=" (cc-for-target))
  555. (string-append "prefix=" (assoc-ref %outputs "out")))
  556. #:tests? #f)) ; no tests
  557. (inputs
  558. `(("readline" ,readline)))
  559. (home-page "https://mujs.com/")
  560. (synopsis "JavaScript interpreter written in C")
  561. (description "MuJS is a lightweight Javascript interpreter designed for
  562. embedding in other software to extend them with scripting capabilities. MuJS
  563. was designed with a focus on small size, correctness, and simplicity. It is
  564. written in portable C and implements ECMAScript as specified by ECMA-262. The
  565. interface for binding with native code is designed to be as simple as possible
  566. to use, and is very similar to Lua. There is no need to interact with byzantine
  567. C++ template mechanisms, or worry about marking and unmarking garbage collection
  568. roots, or wrestle with obscure build systems.")
  569. (license license:isc)))
  570. (define-public quickjs
  571. (package
  572. (name "quickjs")
  573. (version "2021-03-27")
  574. (source (origin
  575. (method url-fetch)
  576. (uri (string-append "https://bellard.org/quickjs/quickjs-"
  577. version ".tar.xz"))
  578. (sha256
  579. (base32
  580. "06pywwpmfwjz225h59wf90q96a2fd66qfcw5xa6m6y9k9k7glnx4"))))
  581. (build-system gnu-build-system)
  582. (arguments
  583. `(#:make-flags
  584. (list "prefix="
  585. (string-append "DESTDIR=" %output))
  586. #:phases
  587. (modify-phases %standard-phases
  588. (delete 'configure)
  589. (replace 'check
  590. (lambda _
  591. (invoke "make" "microbench"))))))
  592. (home-page "https://bellard.org/quickjs/")
  593. (synopsis "Small embeddable Javascript engine")
  594. (description "QuickJS supports the ES2020 specification including modules,
  595. asynchronous generators, proxies, BigInt and BigDecimal. It can compile
  596. Javascript sources to executables with no external dependency. It includes a
  597. command line interpreter with contextual colorization implemented in
  598. Javascript and a small built-in standard library with C library wrappers.")
  599. (license license:expat)))
  600. (define-public duktape
  601. (package
  602. (name "duktape")
  603. (version "2.6.0")
  604. (source (origin
  605. (method url-fetch)
  606. (uri (string-append "https://duktape.org/duktape-"
  607. version ".tar.xz"))
  608. (sha256
  609. (base32
  610. "19szwxzvl2g65fw95ggvb8h0ma5bd9vvnnccn59hwnc4dida1x4n"))))
  611. (build-system gnu-build-system)
  612. (arguments
  613. '(#:tests? #f ; No tests.
  614. #:make-flags (list "-f" "Makefile.sharedlibrary"
  615. (string-append "INSTALL_PREFIX=" %output))
  616. #:phases
  617. (modify-phases %standard-phases
  618. (delete 'configure))))
  619. (home-page "https://duktape.org/")
  620. (synopsis "Small embeddable Javascript engine")
  621. (description "Duktape is an embeddable Javascript engine, with a focus on
  622. portability and compact footprint. Duktape is easy to integrate into a C/C++
  623. project: add @file{duktape.c}, @file{duktape.h}, and @file{duk_config.h} to
  624. your build, and use the Duktape API to call ECMAScript functions from C code
  625. and vice versa.")
  626. (license license:expat)))