| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 |
|
| 26 | (define-module (gnu packages javascript)
|
| 27 | #:use-module ((guix licenses) #:prefix license:)
|
| 28 | #:use-module (gnu packages)
|
| 29 | #:use-module (gnu packages base)
|
| 30 | #:use-module (gnu packages bash)
|
| 31 | #:use-module (gnu packages compression)
|
| 32 | #:use-module (gnu packages java)
|
| 33 | #:use-module (gnu packages node)
|
| 34 | #:use-module (gnu packages readline)
|
| 35 | #:use-module (gnu packages uglifyjs)
|
| 36 | #:use-module (gnu packages web)
|
| 37 | #:use-module (guix gexp)
|
| 38 | #:use-module (guix packages)
|
| 39 | #:use-module (guix download)
|
| 40 | #:use-module (guix git-download)
|
| 41 | #:use-module (guix build-system ant)
|
| 42 | #:use-module (guix build-system cmake)
|
| 43 | #:use-module (guix build-system gnu)
|
| 44 | #:use-module (guix build-system minify)
|
| 45 | #:use-module (guix build-system trivial)
|
| 46 | #:use-module (guix utils))
|
| 47 |
|
| 48 | (define-public cjson
|
| 49 | (package
|
| 50 | (name "cjson")
|
| 51 | (version "1.7.15")
|
| 52 | (source (origin
|
| 53 | (method git-fetch)
|
| 54 | (uri (git-reference
|
| 55 | (url "https://github.com/DaveGamble/cJSON")
|
| 56 | (commit (string-append "v" version))))
|
| 57 | (file-name (git-file-name name version))
|
| 58 | (sha256
|
| 59 | (base32 "0lmq7sx09rmsirimbyvaaia44i134ppkp10cw1d2rygr76k9qwq2"))))
|
| 60 | (build-system cmake-build-system)
|
| 61 | (arguments
|
| 62 | `(#:configure-flags '("-DENABLE_CJSON_UTILS=On")))
|
| 63 | (home-page "https://github.com/DaveGamble/cJSON")
|
| 64 | (synopsis "JSON parser written in ANSI C")
|
| 65 | (description "This library provides a portable embeddable JSON parser.")
|
| 66 | (license license:expat)))
|
| 67 |
|
| 68 | (define-public js-context-menu
|
| 69 | (package
|
| 70 | (name "js-context-menu")
|
| 71 | (version "0.6.1")
|
| 72 | (source
|
| 73 | (origin
|
| 74 | (method git-fetch)
|
| 75 | (uri (git-reference
|
| 76 | (url "https://github.com/zorkow/context-menu")
|
| 77 | (commit (string-append "v" version))))
|
| 78 | (file-name (git-file-name name version))
|
| 79 | (sha256
|
| 80 | (base32
|
| 81 | "1q063l6477z285j6h5wvccp6iswvlp0jmb96sgk32sh0lf7nhknh"))))
|
| 82 | (build-system trivial-build-system)
|
| 83 | (arguments
|
| 84 | `(#:modules ((guix build utils))
|
| 85 | #:builder
|
| 86 | (begin
|
| 87 | (use-modules (guix build utils))
|
| 88 | (chdir (assoc-ref %build-inputs "source"))
|
| 89 | (let ((target (string-append %output "/share/javascript/context-menu")))
|
| 90 | (apply invoke (search-input-file %build-inputs "/bin/esbuild")
|
| 91 | "--bundle"
|
| 92 | "--tsconfig=tsconfig.json"
|
| 93 | (string-append "--outdir=" target)
|
| 94 | (find-files "ts" "\\.ts$"))))))
|
| 95 | (native-inputs
|
| 96 | (list esbuild))
|
| 97 | (home-page "https://github.com/zorkow/context-menu")
|
| 98 | (synopsis "Generic context menu")
|
| 99 | (description "This package provides a reimplementation of the MathJax
|
| 100 | context menu in TypeScript.")
|
| 101 | (license license:asl2.0)))
|
| 102 |
|
| 103 | (define-public font-mathjax
|
| 104 | (package
|
| 105 | (name "font-mathjax")
|
| 106 | (version "2.7.2")
|
| 107 | (source
|
| 108 | (origin
|
| 109 | (method git-fetch)
|
| 110 | (uri (git-reference
|
| 111 | (url "https://github.com/mathjax/MathJax")
|
| 112 | (commit version)))
|
| 113 | (file-name (git-file-name name version))
|
| 114 | (sha256
|
| 115 | (base32
|
| 116 | "127j12g7v2hx6k7r00b8cp49s7nkrwhxy6l8p03pw34xpxbgbimm"))))
|
| 117 | (build-system trivial-build-system)
|
| 118 | (arguments
|
| 119 | `(#:modules ((guix build utils))
|
| 120 | #:builder
|
| 121 | (begin
|
| 122 | (use-modules (guix build utils)
|
| 123 | (ice-9 match))
|
| 124 | (let ((install-directory (string-append %output "/share/fonts/mathjax")))
|
| 125 | (mkdir-p install-directory)
|
| 126 | (copy-recursively (string-append (assoc-ref %build-inputs "source")
|
| 127 | "/fonts")
|
| 128 | install-directory)))))
|
| 129 | (home-page "https://www.mathjax.org/")
|
| 130 | (synopsis "Fonts for MathJax")
|
| 131 | (description "This package contains the fonts required for MathJax.")
|
| 132 | (license license:asl2.0)))
|
| 133 |
|
| 134 | (define-public js-mathjax
|
| 135 | (package
|
| 136 | (inherit font-mathjax)
|
| 137 | (name "js-mathjax")
|
| 138 | (arguments
|
| 139 | `(#:modules ((guix build utils))
|
| 140 | #:builder
|
| 141 | (begin
|
| 142 | (use-modules (guix build utils)
|
| 143 | (ice-9 match)
|
| 144 | (ice-9 popen)
|
| 145 | (ice-9 regex))
|
| 146 | (set-path-environment-variable
|
| 147 | "PATH" '("bin") (map (match-lambda
|
| 148 | ((_ . input)
|
| 149 | input))
|
| 150 | %build-inputs))
|
| 151 | (set-path-environment-variable
|
| 152 | "GUIX_LOCPATH" '("lib/locale")
|
| 153 | (list (assoc-ref %build-inputs "glibc-utf8-locales")))
|
| 154 | (setenv "LANG" "en_US.UTF-8")
|
| 155 | (let ((install-directory (string-append %output "/share/javascript/mathjax")))
|
| 156 | (copy-recursively (string-append (assoc-ref %build-inputs "source") "/unpacked")
|
| 157 | "MathJax-unpacked")
|
| 158 | (mkdir-p install-directory)
|
| 159 | (symlink (string-append (assoc-ref %build-inputs "font-mathjax")
|
| 160 | "/share/fonts/mathjax")
|
| 161 | (string-append install-directory "/fonts"))
|
| 162 |
|
| 163 | (for-each
|
| 164 | (lambda (file)
|
| 165 | (let ((installed (string-append install-directory
|
| 166 | |
| 167 | (string-drop file 18))))
|
| 168 | (format #t "~a -> ~a~%" file installed)
|
| 169 | (cond
|
| 170 | ((string-match "\\.js$" file)
|
| 171 | (mkdir-p (dirname installed))
|
| 172 | (let ((minified (open-pipe* OPEN_READ "uglifyjs" file)))
|
| 173 | (call-with-output-file installed
|
| 174 | (lambda (port)
|
| 175 | (dump-port minified port)))
|
| 176 |
|
| 177 | (let ((exit (close-pipe minified)))
|
| 178 | (unless (zero? exit)
|
| 179 | (error "dear, uglifyjs failed" exit)))))
|
| 180 | (else
|
| 181 | (install-file file (dirname installed))))))
|
| 182 | (find-files "."))
|
| 183 |
|
| 184 | #t))))
|
| 185 | (native-inputs
|
| 186 | `(("font-mathjax" ,font-mathjax)
|
| 187 | ("glibc-utf8-locales" ,glibc-utf8-locales)
|
| 188 | ("uglifyjs" ,node-uglify-js)
|
| 189 | ,@(package-native-inputs font-mathjax)))
|
| 190 | (synopsis "JavaScript display engine for LaTeX, MathML, and AsciiMath")
|
| 191 | (description "MathJax is a JavaScript display engine for LaTeX, MathML,
|
| 192 | and AsciiMath notation that works in all modern browsers. It requires no
|
| 193 | plugins or software to be installed on the browser. So the page author can
|
| 194 | write web documents that include mathematics and be confident that readers will
|
| 195 | be able to view it naturally and easily.")))
|
| 196 |
|
| 197 | (define-public js-mathjax-3
|
| 198 | (package
|
| 199 | (name "js-mathjax")
|
| 200 | (version "3.2.0")
|
| 201 | (source
|
| 202 | (origin
|
| 203 | (method git-fetch)
|
| 204 | (uri (git-reference
|
| 205 | (url "https://github.com/mathjax/MathJax-src")
|
| 206 | (commit version)))
|
| 207 | (file-name (git-file-name name version))
|
| 208 | (sha256
|
| 209 | (base32
|
| 210 | "05lm6nw7rzpcc5yz7xsjxi4id9369vvnrksx82nglxrqrpws97wx"))
|
| 211 | (patches (search-patches "mathjax-disable-webpack.patch"
|
| 212 | "mathjax-no-a11y.patch"))))
|
| 213 | (build-system gnu-build-system)
|
| 214 | (arguments
|
| 215 | `(#:phases
|
| 216 | (modify-phases %standard-phases
|
| 217 | (add-after 'unpack 'prepare-sources
|
| 218 | (lambda* (#:key inputs #:allow-other-keys)
|
| 219 | |
| 220 | |
| 221 | (delete-file-recursively "ts/a11y")
|
| 222 | (delete-file-recursively "components/src/a11y")
|
| 223 | (delete-file-recursively "components/src/sre")
|
| 224 | (delete-file-recursively "components/src/node-main")
|
| 225 |
|
| 226 | |
| 227 | (mkdir-p "node_modules")
|
| 228 | (with-directory-excursion "node_modules"
|
| 229 | (for-each
|
| 230 | (lambda (p)
|
| 231 | (copy-recursively (assoc-ref inputs (string-append "node-" p)) p))
|
| 232 | '("mj-context-menu" "mhchemparser")))
|
| 233 |
|
| 234 | |
| 235 | (symlink "ts" "js")
|
| 236 | (symlink "ts" "node_modules/mj-context-menu/js")))
|
| 237 | (delete 'configure)
|
| 238 | (replace 'build
|
| 239 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 240 | (let ((esbuild (string-append (assoc-ref inputs "esbuild")
|
| 241 | "/bin/esbuild"))
|
| 242 | (node (string-append (assoc-ref inputs "node")
|
| 243 | "/bin/node"))
|
| 244 | (target (string-append (assoc-ref outputs "out")
|
| 245 | "/share/javascript/mathjax/es5")))
|
| 246 | |
| 247 | (invoke node "components/bin/makeAll")
|
| 248 | |
| 249 | (apply
|
| 250 | invoke
|
| 251 | esbuild
|
| 252 | "--bundle"
|
| 253 | "--minify"
|
| 254 | |
| 255 | "--target=es6"
|
| 256 | (string-append "--outdir=" target)
|
| 257 | "--sourcemap"
|
| 258 | "--outbase=components/src"
|
| 259 | "--define:__dirname=\"/\""
|
| 260 | |
| 261 | |
| 262 | "--define:global=window"
|
| 263 | |
| 264 | |
| 265 | (filter
|
| 266 | (lambda (f)
|
| 267 | (string=?
|
| 268 | (basename (dirname f))
|
| 269 | (string-drop-right (basename f) 3)))
|
| 270 | (find-files "components/src" "\\.js$")))
|
| 271 | |
| 272 | |
| 273 | (for-each
|
| 274 | (lambda (f)
|
| 275 | (rename-file f (string-append (dirname (dirname f)) "/" (basename f))))
|
| 276 | (find-files target "\\.js(\\.map)?$"))
|
| 277 | |
| 278 | (copy-recursively
|
| 279 | "ts/output/chtml/fonts/tex-woff-v2"
|
| 280 | (string-append target "/output/chtml/fonts/woff-v2")))))
|
| 281 | (delete 'check)
|
| 282 | (delete 'install))))
|
| 283 | (native-inputs
|
| 284 | `(("esbuild" ,esbuild)
|
| 285 | ("node" ,node-lts)
|
| 286 | ("node-mj-context-menu"
|
| 287 | ,(let ((name "context-menu")
|
| 288 | (version "0.6.1"))
|
| 289 | (origin
|
| 290 | (method git-fetch)
|
| 291 | (uri (git-reference
|
| 292 | (url "https://github.com/zorkow/context-menu.git")
|
| 293 | (commit (string-append "v" version))))
|
| 294 | (file-name (git-file-name name version))
|
| 295 | (sha256
|
| 296 | (base32
|
| 297 | "1q063l6477z285j6h5wvccp6iswvlp0jmb96sgk32sh0lf7nhknh")))))
|
| 298 | ("node-mhchemparser"
|
| 299 | ,(let ((name "mhchemparser")
|
| 300 | |
| 301 | (version "b1bd0670df7e9bbd5a724ac642aa2664d6e500b3"))
|
| 302 | (origin
|
| 303 | (method git-fetch)
|
| 304 | (uri (git-reference
|
| 305 | (url "https://github.com/mhchem/mhchemParser.git")
|
| 306 | (commit version)))
|
| 307 | (file-name (git-file-name name version))
|
| 308 | (sha256
|
| 309 | (base32
|
| 310 | "1g72kbxzf9f2igidpma3jwk28ln4bp3qhwspmhnm79baf3701dgv")))))))
|
| 311 | (home-page "https://www.mathjax.org/")
|
| 312 | (synopsis (package-synopsis js-mathjax))
|
| 313 | (description (package-description js-mathjax))
|
| 314 | (license license:asl2.0)))
|
| 315 |
|
| 316 | (define-public js-mathjax-for-r-mathjaxr
|
| 317 | (package
|
| 318 | (inherit js-mathjax-3)
|
| 319 | (name "js-mathjax")
|
| 320 | (version "3.1.2")
|
| 321 | (source
|
| 322 | (origin
|
| 323 | (method git-fetch)
|
| 324 | (uri (git-reference
|
| 325 | (url "https://github.com/mathjax/MathJax-src")
|
| 326 | (commit version)))
|
| 327 | (file-name (git-file-name name version))
|
| 328 | (sha256
|
| 329 | (base32
|
| 330 | "0kqcb6pl0zfs4hf8zqb4l50kkfq7isv35vpy05m0lg0yr9w0w4ai"))
|
| 331 | (patches (search-patches "mathjax-disable-webpack.patch"
|
| 332 | "mathjax-3.1.2-no-a11y.patch"))))
|
| 333 | (arguments
|
| 334 | (substitute-keyword-arguments (package-arguments js-mathjax-3)
|
| 335 | ((#:phases phases '%standard-phases)
|
| 336 | `(modify-phases ,phases
|
| 337 | (replace 'prepare-sources
|
| 338 | (lambda* (#:key inputs #:allow-other-keys)
|
| 339 | |
| 340 | |
| 341 | (delete-file-recursively "ts/a11y")
|
| 342 | (delete-file-recursively "components/src/a11y")
|
| 343 | (delete-file-recursively "components/src/sre")
|
| 344 | (delete-file-recursively "components/src/node-main")
|
| 345 |
|
| 346 | |
| 347 | (mkdir-p "node_modules")
|
| 348 | (with-directory-excursion "node_modules"
|
| 349 | (for-each
|
| 350 | (lambda (p)
|
| 351 | (copy-recursively (assoc-ref inputs (string-append "node-" p)) p))
|
| 352 | '("mj-context-menu")))
|
| 353 |
|
| 354 | |
| 355 | (symlink "ts" "js")
|
| 356 | (symlink "ts" "node_modules/mj-context-menu/js")))))))
|
| 357 | (native-inputs
|
| 358 | `(("esbuild" ,esbuild)
|
| 359 | ("node" ,node-lts)
|
| 360 | ("node-mj-context-menu"
|
| 361 | ,(let ((name "context-menu")
|
| 362 | (version "0.6.1"))
|
| 363 | (origin
|
| 364 | (method git-fetch)
|
| 365 | (uri (git-reference
|
| 366 | (url "https://github.com/zorkow/context-menu.git")
|
| 367 | (commit (string-append "v" version))))
|
| 368 | (file-name (git-file-name name version))
|
| 369 | (sha256
|
| 370 | (base32
|
| 371 | "1q063l6477z285j6h5wvccp6iswvlp0jmb96sgk32sh0lf7nhknh")))))))))
|
| 372 |
|
| 373 | (define-public js-commander
|
| 374 | (package
|
| 375 | (name "js-commander")
|
| 376 | (version "6.2.1")
|
| 377 | (source
|
| 378 | (origin
|
| 379 | (method git-fetch)
|
| 380 | (uri (git-reference
|
| 381 | (url "https://github.com/tj/commander.js")
|
| 382 | (commit (string-append "v" version))))
|
| 383 | (file-name (git-file-name name version))
|
| 384 | (sha256
|
| 385 | (base32
|
| 386 | "126m25s6mxpxmdj4aw5awz06b47r8r798lcf1c5bnmmh39cik5i1"))))
|
| 387 | (build-system trivial-build-system)
|
| 388 | (arguments
|
| 389 | `(#:modules ((guix build utils))
|
| 390 | #:builder
|
| 391 | (begin
|
| 392 | (use-modules (guix build utils))
|
| 393 | (chdir (assoc-ref %build-inputs "source"))
|
| 394 | (let ((esbuild (search-input-file %build-inputs "/bin/esbuild"))
|
| 395 | (target (string-append %output "/share/javascript/commander")))
|
| 396 | (invoke esbuild
|
| 397 | "--bundle"
|
| 398 | "--minify"
|
| 399 | "--tsconfig=tsconfig.json"
|
| 400 | "--platform=node"
|
| 401 | (string-append "--outfile=" target "/index.min.js")
|
| 402 | "index.js")))))
|
| 403 | (native-inputs
|
| 404 | (list esbuild))
|
| 405 | (home-page "https://github.com/tj/commander.js")
|
| 406 | (synopsis "Library for node.js command-line interfaces")
|
| 407 | (description "Commander.js aims to be the complete solution for node.js
|
| 408 | command-line interfaces.")
|
| 409 | (license license:expat)))
|
| 410 |
|
| 411 | (define-public js-xmldom-sre
|
| 412 | |
| 413 | (let ((commit "3c79325bc2c9e5d27e3ba44b680fa8c5dd6a381d")
|
| 414 | (revision "1"))
|
| 415 | (package
|
| 416 | (name "js-xmldom-sre")
|
| 417 | (version "0.1.32")
|
| 418 | (source
|
| 419 | (origin
|
| 420 | (method git-fetch)
|
| 421 | (uri (git-reference
|
| 422 | (url "https://github.com/zorkow/xmldom/")
|
| 423 | (commit commit)))
|
| 424 | (file-name (git-file-name name version))
|
| 425 | (sha256
|
| 426 | (base32
|
| 427 | "0a88v0id3mjflpvjqhv8a28br0xvaaszxbf7alg6pxfbnkb69yyq"))))
|
| 428 | (build-system trivial-build-system)
|
| 429 | (arguments
|
| 430 | `(#:modules ((guix build utils))
|
| 431 | #:builder
|
| 432 | (begin
|
| 433 | (use-modules (guix build utils))
|
| 434 | (chdir (assoc-ref %build-inputs "source"))
|
| 435 | (let ((esbuild (search-input-file %build-inputs "/bin/esbuild"))
|
| 436 | (target (string-append %output "/share/javascript/xmldom-sre")))
|
| 437 | (invoke esbuild
|
| 438 | "--bundle"
|
| 439 | "--minify"
|
| 440 | "--platform=node"
|
| 441 | (string-append "--outfile=" target "/dom-parser.min.js")
|
| 442 | "dom-parser.js")))))
|
| 443 | (native-inputs
|
| 444 | (list esbuild))
|
| 445 | (home-page "https://github.com/zorkow/xmldom/")
|
| 446 | (synopsis "DOM parser and XML serializer")
|
| 447 | (description "This is a fork of the xmldom library. It allows the use
|
| 448 | of wicked-good-xpath together with xmldom.")
|
| 449 | |
| 450 | (license (list license:expat
|
| 451 | license:lgpl2.0)))))
|
| 452 |
|
| 453 | (define-public js-respond
|
| 454 | (package
|
| 455 | (name "js-respond")
|
| 456 | (version "1.4.2")
|
| 457 | (source (origin
|
| 458 | (method git-fetch)
|
| 459 | (uri (git-reference
|
| 460 | (url "https://github.com/scottjehl/Respond")
|
| 461 | (commit version)))
|
| 462 | (file-name (git-file-name name version))
|
| 463 | (sha256
|
| 464 | (base32
|
| 465 | "00xid731rirc7sdy1gc8qal3v9g0agr2qx15hm4x97l1lcbylyn2"))))
|
| 466 | (build-system minify-build-system)
|
| 467 | (arguments
|
| 468 | `(#:javascript-files '("src/matchmedia.addListener.js"
|
| 469 | "src/matchmedia.polyfill.js"
|
| 470 | "src/respond.js")))
|
| 471 | (home-page "https://github.com/scottjehl/Respond")
|
| 472 | (synopsis "Polyfill for min/max-width CSS3 Media Queries")
|
| 473 | (description "The goal of this script is to provide a fast and lightweight
|
| 474 | script to enable responsive web designs in browsers that don't support CSS3
|
| 475 | Media Queries.")
|
| 476 | (license license:expat)))
|
| 477 |
|
| 478 | (define-public js-html5shiv
|
| 479 | (package
|
| 480 | (name "js-html5shiv")
|
| 481 | (version "3.7.3")
|
| 482 | (source (origin
|
| 483 | (method git-fetch)
|
| 484 | (uri (git-reference
|
| 485 | (url "https://github.com/aFarkas/html5shiv")
|
| 486 | (commit version)))
|
| 487 | (file-name (git-file-name name version))
|
| 488 | (sha256
|
| 489 | (base32
|
| 490 | "0y1c5nyq0brl9fjdihhax33vks4s1ij9iv113879sg3zflmgqpd0"))))
|
| 491 | (build-system minify-build-system)
|
| 492 | (home-page "https://github.com/aFarkas/html5shiv")
|
| 493 | (synopsis "Enable HTML5 sectioning elements in legacy browsers")
|
| 494 | (description "The HTML5 Shiv enables use of HTML5 sectioning elements in
|
| 495 | legacy Internet Explorer and provides basic HTML5 styling for Internet
|
| 496 | Explorer 6-9, Safari 4.x (and iPhone 3.x), and Firefox 3.x.")
|
| 497 | |
| 498 | |
| 499 | |
| 500 | |
| 501 | |
| 502 | (license (list license:expat license:gpl2))))
|
| 503 |
|
| 504 | (define-public js-json2
|
| 505 | (let ((commit "031b1d9e6971bd4c433ca85e216cc853f5a867bd")
|
| 506 | (revision "1"))
|
| 507 | (package
|
| 508 | (name "js-json2")
|
| 509 | (version (string-append "2016-10-28." revision "-" (string-take commit 7)))
|
| 510 | (source (origin
|
| 511 | (method git-fetch)
|
| 512 | (uri (git-reference
|
| 513 | (url "https://github.com/douglascrockford/JSON-js")
|
| 514 | (commit commit)))
|
| 515 | (file-name (string-append name "-" version "-checkout"))
|
| 516 | (sha256
|
| 517 | (base32
|
| 518 | "1fvb6b2y5sd3sqdgcj683sdxcbxdii34q0ysc9wg0dq1sy81l11v"))))
|
| 519 | (build-system minify-build-system)
|
| 520 | (arguments
|
| 521 | `(#:javascript-files '("json2.js"
|
| 522 | "json_parse.js"
|
| 523 | "json_parse_state.js"
|
| 524 | "cycle.js")))
|
| 525 | (home-page "https://github.com/douglascrockford/JSON-js")
|
| 526 | (synopsis "JSON encoders and decoders")
|
| 527 | (description "The files in this collection implement JSON
|
| 528 | encoders/decoders in JavaScript.
|
| 529 |
|
| 530 | @code{json2.js}: This file creates a JSON property in the global object, if
|
| 531 | there isn't already one, setting its value to an object containing a stringify
|
| 532 | method and a parse method. The @code{parse} method uses the @code{eval}
|
| 533 | method to do the parsing, guarding it with several regular expressions to
|
| 534 | defend against accidental code execution hazards. On current browsers, this
|
| 535 | file does nothing, preferring the built-in JSON object.
|
| 536 |
|
| 537 | @code{json_parse.js}: This file contains an alternative JSON @code{parse}
|
| 538 | function that uses recursive descent instead of @code{eval}.
|
| 539 |
|
| 540 | @code{json_parse_state.js}: This files contains an alternative JSON
|
| 541 | @code{parse} function that uses a state machine instead of @code{eval}.
|
| 542 |
|
| 543 | @code{cycle.js}: This file contains two functions, @code{JSON.decycle} and
|
| 544 | @code{JSON.retrocycle}, which make it possible to encode cyclical structures
|
| 545 | and DAGs in JSON, and to then recover them. This is a capability that is not
|
| 546 | provided by ES5. @code{JSONPath} is used to represent the links.")
|
| 547 | (license license:public-domain))))
|
| 548 |
|
| 549 | (define-public js-strftime
|
| 550 | (package
|
| 551 | (name "js-strftime")
|
| 552 | (version "0.10.0")
|
| 553 | (source (origin
|
| 554 | (method git-fetch)
|
| 555 | (uri (git-reference
|
| 556 | (url"https://github.com/samsonjs/strftime")
|
| 557 | (commit (string-append "v" version))))
|
| 558 | (file-name (git-file-name name version))
|
| 559 | (sha256
|
| 560 | (base32
|
| 561 | "131nmlivazwxyba25kh9lda99749fq4xsyin6lzfalaaydviby4p"))))
|
| 562 | (build-system minify-build-system)
|
| 563 | (arguments
|
| 564 | `(#:javascript-files '("strftime.js")))
|
| 565 | (home-page "https://github.com/samsonjs/strftime")
|
| 566 | (synopsis "Implementation of strftime to JavaScript")
|
| 567 | (description "This is an implementation of the @code{strftime} procedure
|
| 568 | for JavaScript. It works in (at least) node.js and browsers. It supports
|
| 569 | localization and timezones. Most standard specifiers from C are supported as
|
| 570 | well as some other extensions from Ruby.")
|
| 571 | (license license:expat)))
|
| 572 |
|
| 573 | (define-public js-highlight
|
| 574 | (package
|
| 575 | (name "js-highlight")
|
| 576 | (version "9.12.0")
|
| 577 | (source (origin
|
| 578 | (method git-fetch)
|
| 579 | (uri (git-reference
|
| 580 | (url "https://github.com/isagalaev/highlight.js")
|
| 581 | (commit version)))
|
| 582 | (file-name (git-file-name name version))
|
| 583 | (sha256
|
| 584 | (base32
|
| 585 | "12qz22qjpd6svj58pwgcwg2x2rzhihfdrxg6lgj39nfpaln6dris"))))
|
| 586 | (build-system minify-build-system)
|
| 587 | (arguments
|
| 588 | `(#:javascript-files '("src/highlight.js")))
|
| 589 | (home-page "https://github.com/isagalaev/highlight.js")
|
| 590 | (synopsis "Syntax highlighting for JavaScript")
|
| 591 | (description "Highlight.js is a syntax highlighter written in JavaScript.
|
| 592 | It works in the browser as well as on the server. It works with pretty much
|
| 593 | any markup, doesn’t depend on any framework and has automatic language
|
| 594 | detection.")
|
| 595 | (license license:bsd-3)))
|
| 596 |
|
| 597 | (define-public js-datatables
|
| 598 | (package
|
| 599 | (name "js-datatables")
|
| 600 | (version "1.10.19")
|
| 601 | (source (origin
|
| 602 | (method url-fetch)
|
| 603 | (uri (string-append "https://datatables.net/releases/DataTables-"
|
| 604 | version ".zip"))
|
| 605 | (sha256
|
| 606 | (base32
|
| 607 | "0cff8a1g7pjwbjdqq0yzqd963ar7pfi4splmm6rwdzganr77rkhb"))))
|
| 608 | (build-system minify-build-system)
|
| 609 | (arguments
|
| 610 | `(#:javascript-files '("media/js/dataTables.bootstrap.js"
|
| 611 | "media/js/jquery.dataTables.js")))
|
| 612 | (native-inputs
|
| 613 | (list unzip))
|
| 614 | (home-page "https://datatables.net")
|
| 615 | (synopsis "DataTables plug-in for jQuery")
|
| 616 | (description "DataTables is a table enhancing plug-in for the jQuery
|
| 617 | Javascript library, adding sorting, paging and filtering abilities to plain
|
| 618 | HTML tables with minimal effort.")
|
| 619 | (license license:expat)))
|
| 620 |
|
| 621 | (define-public js-requirejs
|
| 622 | (package
|
| 623 | (name "js-requirejs")
|
| 624 | (version "2.3.6")
|
| 625 | (source (origin
|
| 626 | (method git-fetch)
|
| 627 | (uri (git-reference
|
| 628 | (url "https://github.com/requirejs/requirejs")
|
| 629 | (commit version)))
|
| 630 | (file-name (git-file-name name version))
|
| 631 | (sha256
|
| 632 | (base32
|
| 633 | "0cvd5y2mb3h6yil3niqn3gjqrzixdsxcz4rvc2f0hg4kzp5y0w86"))))
|
| 634 | (build-system minify-build-system)
|
| 635 | (arguments `(#:javascript-files '("require.js")))
|
| 636 | (home-page "https://github.com/requirejs/requirejs/")
|
| 637 | (synopsis "File and module loader for JavaScript")
|
| 638 | (description "RequireJS loads plain JavaScript files as well as more
|
| 639 | defined modules. It is optimized for in-browser use, including in a Web
|
| 640 | Worker, but it can be used in other JavaScript environments.")
|
| 641 | (license license:expat)))
|
| 642 |
|
| 643 | (define-public js-selectize
|
| 644 | (package
|
| 645 | (name "js-selectize")
|
| 646 | (version "0.12.6")
|
| 647 | (source (origin
|
| 648 | (method git-fetch)
|
| 649 | (uri (git-reference
|
| 650 | (url "https://github.com/selectize/selectize.js")
|
| 651 | (commit (string-append "v" version))))
|
| 652 | (file-name (git-file-name name version))
|
| 653 | (sha256
|
| 654 | (base32
|
| 655 | "15gichl8wi6yxag2ps723nxrgyan15976dzsnvw9h9py8sbyyzjn"))))
|
| 656 | (build-system minify-build-system)
|
| 657 | |
| 658 | |
| 659 | |
| 660 | (arguments `(#:javascript-files '("dist/js/standalone/selectize.js")))
|
| 661 | (home-page "https://selectize.github.io/selectize.js/")
|
| 662 | (synopsis "Hybrid widget between a textbox and <select> box")
|
| 663 | (description "Selectize is the hybrid of a textbox and @code{<select>}
|
| 664 | box. It's jQuery based and it has autocomplete and native-feeling keyboard
|
| 665 | navigation; it is useful for tagging, contact lists, etc.")
|
| 666 | (license license:asl2.0)))
|
| 667 |
|
| 668 | (define-public js-es5-shim
|
| 669 | (package
|
| 670 | (name "js-es5-shim")
|
| 671 | (version "4.5.13")
|
| 672 | (source (origin
|
| 673 | (method git-fetch)
|
| 674 | (uri (git-reference
|
| 675 | (url "https://github.com/es-shims/es5-shim")
|
| 676 | (commit (string-append "v" version))))
|
| 677 | (file-name (git-file-name name version))
|
| 678 | (sha256
|
| 679 | (base32
|
| 680 | "142w384fbyllq4yggv173g82lw3wix4jqcg6hkhx1ymq89vvnpmh"))))
|
| 681 | (build-system minify-build-system)
|
| 682 | (arguments `(#:javascript-files
|
| 683 | '("es5-sham.js"
|
| 684 | "es5-shim.js")))
|
| 685 | (home-page "https://github.com/es-shims/es5-shim")
|
| 686 | (synopsis "ECMAScript 5 compatibility shims for legacy JavaScript engines")
|
| 687 | (description "@code{es5-shim.js} patches a JavaScript context to contain
|
| 688 | all ECMAScript 5 methods that can be faithfully emulated with a legacy
|
| 689 | JavaScript engine. @code{es5-sham.js} patches other ES5 methods as closely as
|
| 690 | possible. Many of these shams are intended only to allow code to be written
|
| 691 | to ES5 without causing run-time errors in older engines. In many cases, this
|
| 692 | means that these shams cause many ES5 methods to silently fail.")
|
| 693 | (license license:expat)))
|
| 694 |
|
| 695 | (define-public js-filesaver
|
| 696 | (package
|
| 697 | (name "js-filesaver")
|
| 698 | (version "1.3.8")
|
| 699 | (source (origin
|
| 700 | (method git-fetch)
|
| 701 | (uri (git-reference
|
| 702 | (url "https://github.com/eligrey/FileSaver.js")
|
| 703 | (commit version)))
|
| 704 | (file-name (git-file-name name version))
|
| 705 | (sha256
|
| 706 | (base32
|
| 707 | "0gvqk0hnr8fig0n4da7vj7q6z31bcyv52916xz3rbmdj3pgpiv1d"))))
|
| 708 | (build-system minify-build-system)
|
| 709 | (arguments
|
| 710 | `(#:phases
|
| 711 | (modify-phases %standard-phases
|
| 712 | (add-after 'unpack 'fix-uglification
|
| 713 | |
| 714 | |
| 715 | |
| 716 | |
| 717 | (lambda _
|
| 718 | (substitute* "src/FileSaver.js"
|
| 719 | (("export ") ""))
|
| 720 | #t))
|
| 721 | (add-after 'install 'install-unminified-version
|
| 722 | (lambda* (#:key outputs #:allow-other-keys)
|
| 723 | (install-file "src/FileSaver.js"
|
| 724 | (string-append (assoc-ref outputs "out")
|
| 725 | "/share/javascript"))
|
| 726 | #t)))))
|
| 727 | (home-page
|
| 728 | "https://eligrey.com/blog/saving-generated-files-on-the-client-side/")
|
| 729 | (synopsis "HTML5 saveAs() FileSaver implementation")
|
| 730 | (description "@file{FileSaver.js} implements the @code{saveAs()}
|
| 731 | FileSaver interface in browsers that do not natively support it.
|
| 732 |
|
| 733 | @file{FileSaver.js} is the solution to saving files on the
|
| 734 | client-side, and is perfect for webapps that need to generate files,
|
| 735 | or for saving sensitive information that shouldn't be sent to an
|
| 736 | external server.")
|
| 737 | (license license:expat)))
|
| 738 |
|
| 739 | (define-public js-scianimator
|
| 740 | (package
|
| 741 | (name "js-scianimator")
|
| 742 | (version "1.4")
|
| 743 | (source (origin
|
| 744 | (method git-fetch)
|
| 745 | (uri (git-reference
|
| 746 | (url "https://github.com/brentertz/scianimator.git")
|
| 747 | (commit version)))
|
| 748 | (file-name (git-file-name name version))
|
| 749 | (sha256
|
| 750 | (base32
|
| 751 | "0b4r6z85gnsjagdchvf1pvrhylfiaidh701hna8jrm0l4kbb735x"))))
|
| 752 | (build-system minify-build-system)
|
| 753 | (arguments
|
| 754 | '(#:javascript-files
|
| 755 | (list "assets/js/jquery.scianimator.js")))
|
| 756 | (home-page "https://github.com/brentertz/scianimator")
|
| 757 | (synopsis "Scientific image animator plugin for jQuery")
|
| 758 | (description "SciAnimator provides a simple yet powerful interface for
|
| 759 | animating a series of images.")
|
| 760 | (license license:expat)))
|
| 761 |
|
| 762 | (define-public mujs
|
| 763 | (package
|
| 764 | (name "mujs")
|
| 765 | (version "1.2.0")
|
| 766 | (source
|
| 767 | (origin
|
| 768 | (method git-fetch)
|
| 769 | (uri (git-reference
|
| 770 | (url "https://github.com/ccxvii/mujs")
|
| 771 | (commit version)))
|
| 772 | (file-name (git-file-name name version))
|
| 773 | (sha256
|
| 774 | (base32 "0kqw3xhjk4l2jar14a1f9b3m0xq0h2g3nc9m6hsdv7kf8jhfm83l"))
|
| 775 | (snippet
|
| 776 | #~(begin
|
| 777 | (use-modules (guix build utils))
|
| 778 | (for-each delete-file
|
| 779 | (list "astnames.h"
|
| 780 | "opnames.h"
|
| 781 | "one.c"))))))
|
| 782 | (build-system gnu-build-system)
|
| 783 | (arguments
|
| 784 | (list
|
| 785 | #:phases
|
| 786 | #~(modify-phases %standard-phases
|
| 787 | (delete 'configure) |
| 788 | (replace 'install
|
| 789 | (lambda* (#:key (make-flags '()) #:allow-other-keys)
|
| 790 | (apply invoke "make" "install-shared" make-flags))))
|
| 791 | #:make-flags
|
| 792 | #~(list (string-append "VERSION=" #$version)
|
| 793 | (string-append "CC=" #$(cc-for-target))
|
| 794 | (string-append "prefix=" #$output))
|
| 795 | #:tests? #f)) |
| 796 | (inputs
|
| 797 | (list readline))
|
| 798 | (home-page "https://mujs.com/")
|
| 799 | (synopsis "JavaScript interpreter written in C")
|
| 800 | (description "MuJS is a lightweight Javascript interpreter designed for
|
| 801 | embedding in other software to extend them with scripting capabilities. MuJS
|
| 802 | was designed with a focus on small size, correctness, and simplicity. It is
|
| 803 | written in portable C and implements ECMAScript as specified by ECMA-262. The
|
| 804 | interface for binding with native code is designed to be as simple as possible
|
| 805 | to use, and is very similar to Lua. There is no need to interact with byzantine
|
| 806 | C++ template mechanisms, or worry about marking and unmarking garbage collection
|
| 807 | roots, or wrestle with obscure build systems.")
|
| 808 | (license license:isc)))
|
| 809 |
|
| 810 | (define-public quickjs
|
| 811 | (package
|
| 812 | (name "quickjs")
|
| 813 | (version "2021-03-27")
|
| 814 | (source (origin
|
| 815 | (method url-fetch)
|
| 816 | (uri (string-append "https://bellard.org/quickjs/quickjs-"
|
| 817 | version ".tar.xz"))
|
| 818 | (sha256
|
| 819 | (base32
|
| 820 | "06pywwpmfwjz225h59wf90q96a2fd66qfcw5xa6m6y9k9k7glnx4"))))
|
| 821 | (build-system gnu-build-system)
|
| 822 | (arguments
|
| 823 | `(#:make-flags
|
| 824 | (list "prefix="
|
| 825 | (string-append "DESTDIR=" %output))
|
| 826 | #:phases
|
| 827 | (modify-phases %standard-phases
|
| 828 | (delete 'configure)
|
| 829 | (replace 'check
|
| 830 | (lambda _
|
| 831 | (invoke "make" "microbench"))))))
|
| 832 | (home-page "https://bellard.org/quickjs/")
|
| 833 | (synopsis "Small embeddable Javascript engine")
|
| 834 | (description "QuickJS supports the ES2020 specification including modules,
|
| 835 | asynchronous generators, proxies, BigInt and BigDecimal. It can compile
|
| 836 | Javascript sources to executables with no external dependency. It includes a
|
| 837 | command line interpreter with contextual colorization implemented in
|
| 838 | Javascript and a small built-in standard library with C library wrappers.")
|
| 839 | (license license:expat)))
|
| 840 |
|
| 841 | (define-public duktape
|
| 842 | (package
|
| 843 | (name "duktape")
|
| 844 | (version "2.6.0")
|
| 845 | (source (origin
|
| 846 | (method url-fetch)
|
| 847 | (uri (string-append "https://duktape.org/duktape-"
|
| 848 | version ".tar.xz"))
|
| 849 | (sha256
|
| 850 | (base32
|
| 851 | "19szwxzvl2g65fw95ggvb8h0ma5bd9vvnnccn59hwnc4dida1x4n"))))
|
| 852 | (build-system gnu-build-system)
|
| 853 | (arguments
|
| 854 | (list #:tests? #f |
| 855 | #:make-flags
|
| 856 | #~(list "-f" "Makefile.sharedlibrary"
|
| 857 | (string-append "INSTALL_PREFIX="
|
| 858 | |
| 859 | #$(if (%current-target-system)
|
| 860 | #~#$output
|
| 861 | #~%output))
|
| 862 | |
| 863 | #$@(if (%current-target-system)
|
| 864 | #~((string-append "CC=" #$(cc-for-target)))
|
| 865 | #~()))
|
| 866 | #:phases
|
| 867 | #~(modify-phases %standard-phases
|
| 868 | (delete 'configure)
|
| 869 | |
| 870 | |
| 871 | (add-after 'install 'install-pkg-config
|
| 872 | (lambda* (#:key outputs #:allow-other-keys)
|
| 873 | (let* ((out (assoc-ref outputs "out"))
|
| 874 | (pkg-config-dir (string-append out "/lib/pkgconfig")))
|
| 875 | (mkdir-p pkg-config-dir)
|
| 876 | (with-output-to-file (string-append pkg-config-dir "/duktape.pc")
|
| 877 | (lambda _
|
| 878 | (format #t "prefix=~@*~a~@
|
| 879 | libdir=${prefix}/lib~@
|
| 880 | includedir=${prefix}/include~@
|
| 881 |
|
| 882 | Name: duktape~@
|
| 883 | Description: Embeddable Javascript engine~@
|
| 884 | Version: ~a~@
|
| 885 | Libs: -L${libdir} -lduktape~@
|
| 886 | Cflags: -I${includedir}~%"
|
| 887 | out #$version)))))))))
|
| 888 | (home-page "https://duktape.org/")
|
| 889 | (synopsis "Small embeddable Javascript engine")
|
| 890 | (description "Duktape is an embeddable Javascript engine, with a focus on
|
| 891 | portability and compact footprint. Duktape is easy to integrate into a C/C++
|
| 892 | project: add @file{duktape.c}, @file{duktape.h}, and @file{duk_config.h} to
|
| 893 | your build, and use the Duktape API to call ECMAScript functions from C code
|
| 894 | and vice versa.")
|
| 895 | (license license:expat)))
|
| 896 |
|
| 897 | (define-public rhino
|
| 898 | (package
|
| 899 | (name "rhino")
|
| 900 | (version "1.7.7.2")
|
| 901 | (source (origin
|
| 902 | (method git-fetch)
|
| 903 | (uri (git-reference
|
| 904 | (url "https://github.com/mozilla/rhino.git")
|
| 905 | (commit "935942527ff434b205e797df4185518e5369466e")))
|
| 906 | (file-name (git-file-name name version))
|
| 907 | (sha256
|
| 908 | (base32
|
| 909 | "09i4yr98hs6855fs7fhgmrpiwpr90lhxdv2bvfj97nn4rv1d7wl8"))
|
| 910 | (modules '((guix build utils)))
|
| 911 | (snippet '(begin
|
| 912 | |
| 913 | (delete-file-recursively "testsrc/benchmarks")
|
| 914 | (delete-file-recursively
|
| 915 | "testsrc/org/mozilla/javascript/benchmarks")
|
| 916 | |
| 917 | (format #t "~%~a~%" "Sourced jars")
|
| 918 | (for-each (lambda (f)
|
| 919 | (format #t "~/Deleting: ~a~%" f)
|
| 920 | (delete-file f))
|
| 921 | (find-files "." "\\.jar$"))))))
|
| 922 | (build-system ant-build-system)
|
| 923 | (inputs (list bash-minimal))
|
| 924 | (native-inputs (list java-junit java-hamcrest-core java-snakeyaml))
|
| 925 | (arguments
|
| 926 | `(#:phases
|
| 927 | (modify-phases
|
| 928 | %standard-phases
|
| 929 | (add-after 'unpack 'remove-build-dates
|
| 930 | |
| 931 | (lambda _
|
| 932 | (substitute*
|
| 933 | "build.properties"
|
| 934 | (("..implementation.date.") ""))))
|
| 935 | (replace 'check
|
| 936 | (lambda* (#:key tests? inputs native-inputs
|
| 937 | #:allow-other-keys)
|
| 938 | (when tests?
|
| 939 | (setenv "ANT_OPTS" "-Doffline=true")
|
| 940 | (let ((junit-lib
|
| 941 | (assoc-ref inputs "java-junit"))
|
| 942 | (hamcrest-lib
|
| 943 | (assoc-ref inputs "java-hamcrest-core"))
|
| 944 | (snakeyaml-lib
|
| 945 | (assoc-ref inputs "java-snakeyaml")))
|
| 946 | (with-directory-excursion "testsrc"
|
| 947 | (substitute* "build.xml"
|
| 948 | (("<pathelement location=\"\\$\\{xbean.jar\\}\" */>" all)
|
| 949 | (string-append "<!-- " all " -->"))
|
| 950 | (("<pathelement location=\"\\$\\{jsr173.jar\\}\" */>" all)
|
| 951 | (string-append "<!-- " all " -->"))
|
| 952 | (("<pathelement path=\"\\$\\{coverage.classes.dir\\}\" */>"
|
| 953 | all)
|
| 954 | (string-append "<!-- " all " -->"))
|
| 955 | (("<pathelement path=\"lib/emma.jar\"/>" all)
|
| 956 | (string-append "<!-- " all " -->"))
|
| 957 | (("<pathelement path=\"lib/junit.jar\" ?/>")
|
| 958 | (string-append
|
| 959 | "<fileset dir=\"" junit-lib "\" includes=\"**/*.jar\"/>"))
|
| 960 | (("<pathelement path=\"lib/hamcrest.jar\" ?/>")
|
| 961 | (string-append "<fileset dir=\"" hamcrest-lib
|
| 962 | "\" includes=\"**/*.jar\"/>"))
|
| 963 | (("<pathelement path=\"lib/snakeyaml.jar\" ?/>")
|
| 964 | (string-append "<fileset dir=\"" snakeyaml-lib
|
| 965 | "\" includes=\"**/*.jar\"/>"))
|
| 966 | |
| 967 | (("(<target name=\"junit\" depends=\"junit-compile),.*"
|
| 968 | all pre)
|
| 969 | (string-append pre "\">"))))
|
| 970 | (invoke "ant" "junit")))))
|
| 971 | (replace 'install
|
| 972 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 973 | (let* ((out (assoc-ref outputs "out"))
|
| 974 | (pkg+ver (string-append ,name ,version))
|
| 975 | (bin (string-append out "/bin"))
|
| 976 | (rhino (string-append bin "/rhino"))
|
| 977 | (man (string-append out "/share/man/man1")))
|
| 978 | (mkdir-p bin)
|
| 979 | (install-file "man/rhino.1" man)
|
| 980 | (install-file (string-append "build/" pkg+ver
|
| 981 | "/js.jar")
|
| 982 | (string-append out "/share/java"))
|
| 983 | (with-output-to-file rhino
|
| 984 | (lambda _
|
| 985 | (format #t "#!~a~%~a -jar ~a $@~%"
|
| 986 | (search-input-file inputs "/bin/bash")
|
| 987 | (search-input-file inputs "/bin/java")
|
| 988 | (string-append out "/share/java/js.jar"))))
|
| 989 | (chmod rhino #o755)))))))
|
| 990 | (home-page "https://mozilla.github.io/rhino")
|
| 991 | (synopsis "Javascript implemented in Java")
|
| 992 | (description
|
| 993 | "Rhino implements ECMAScript, also known as JavaScript, in Java as
|
| 994 | specified in the fifth edition of ECMA-262.")
|
| 995 | (license license:mpl2.0)))
|
| 996 |
|