unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: 27935@debbugs.gnu.org
Cc: Ricardo Wurmus <rekado@elephly.net>
Subject: [bug#27935] [PATCH 2/8] gnu: Add js-json2.
Date: Thu,  3 Aug 2017 18:34:32 +0200	[thread overview]
Message-ID: <20170803163438.5742-2-rekado@elephly.net> (raw)
In-Reply-To: <20170803163438.5742-1-rekado@elephly.net>

* gnu/packages/javascript.scm (js-json2): New variable.
---
 gnu/packages/javascript.scm | 49 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
index 836465191..a806cb074 100644
--- a/gnu/packages/javascript.scm
+++ b/gnu/packages/javascript.scm
@@ -26,7 +26,9 @@
   #:use-module (gnu packages lisp)
   #:use-module (guix packages)
   #:use-module (guix download)
-  #:use-module (guix build-system trivial))
+  #:use-module (guix git-download)
+  #:use-module (guix build-system trivial)
+  #:use-module (guix build-system minify))
 
 (define-public js-mathjax
   (package
@@ -159,3 +161,48 @@ Explorer 6-9, Safari 4.x (and iPhone 3.x), and Firefox 3.x.")
     ;;   version 2). This means you are free to choose with which of both
     ;;   licenses (MIT or GPL version 2) you want to use this library.
     (license (list license:expat license:gpl2))))
+
+(define-public js-json2
+  (let ((commit "031b1d9e6971bd4c433ca85e216cc853f5a867bd")
+        (revision "1"))
+    (package
+      (name "js-json2")
+      (version (string-append "2016-10-28." revision "-" (string-take commit 7)))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/douglascrockford/JSON-js.git")
+                      (commit commit)))
+                (file-name (string-append name "-" version "-checkout"))
+                (sha256
+                 (base32
+                  "1fvb6b2y5sd3sqdgcj683sdxcbxdii34q0ysc9wg0dq1sy81l11v"))))
+      (build-system minify-build-system)
+      (arguments
+       `(#:javascript-files '("json2.js"
+                              "json_parse.js"
+                              "json_parse_state.js"
+                              "cycle.js")))
+      (home-page "https://github.com/douglascrockford/JSON-js")
+      (synopsis "JSON encoders and decoders")
+      (description "The files in this collection implement JSON
+encoders/decoders in JavaScript.
+
+@code{json2.js}: This file creates a JSON property in the global object, if
+there isn't already one, setting its value to an object containing a stringify
+method and a parse method.  The @code{parse} method uses the @code{eval}
+method to do the parsing, guarding it with several regular expressions to
+defend against accidental code execution hazards.  On current browsers, this
+file does nothing, preferring the built-in JSON object.
+
+@code{json_parse.js}: This file contains an alternative JSON @code{parse}
+function that uses recursive descent instead of @code{eval}.
+
+@code{json_parse_state.js}: This files contains an alternative JSON
+@code{parse} function that uses a state machine instead of @code{eval}.
+
+@code{cycle.js}: This file contains two functions, @code{JSON.decycle} and
+@code{JSON.retrocycle}, which make it possible to encode cyclical structures
+and DAGs in JSON, and to then recover them.  This is a capability that is not
+provided by ES5.  @code{JSONPath} is used to represent the links.")
+      (license license:public-domain))))
-- 
2.13.3

  reply	other threads:[~2017-08-03 16:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-03 16:30 [bug#27935] gnu: Add r-shiny Ricardo Wurmus
2017-08-03 16:34 ` [bug#27935] [PATCH 1/8] gnu: Add js-html5shiv Ricardo Wurmus
2017-08-03 16:34   ` Ricardo Wurmus [this message]
2017-08-03 16:34   ` [bug#27935] [PATCH 3/8] gnu: Add js-strftime Ricardo Wurmus
2017-08-03 16:34   ` [bug#27935] [PATCH 4/8] gnu: Add js-highlight Ricardo Wurmus
2017-08-03 16:34   ` [bug#27935] [PATCH 5/8] gnu: Add js-datatables Ricardo Wurmus
2017-08-03 16:34   ` [bug#27935] [PATCH 6/8] gnu: Add js-selectize Ricardo Wurmus
2017-08-03 16:34   ` [bug#27935] [PATCH 7/8] gnu: Add js-es5-shim Ricardo Wurmus
2017-08-03 16:34   ` [bug#27935] [PATCH 8/8] gnu: Add r-shiny Ricardo Wurmus
2017-08-04  9:27 ` bug#27924: " Ricardo Wurmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170803163438.5742-2-rekado@elephly.net \
    --to=rekado@elephly.net \
    --cc=27935@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).