>From 2ef0de491f7179412d1d4f804726bd6edbc3f61d Mon Sep 17 00:00:00 2001 From: "Egil D. Priskorn" Date: Mon, 31 Dec 2018 23:54:47 +0100 Subject: [PATCH] WIP swc js-compiler, babel alternative --- gnu/packages/node.scm | 73 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm index a0221601d..3e0a67391 100644 --- a/gnu/packages/node.scm +++ b/gnu/packages/node.scm @@ -27,7 +27,9 @@ #:use-module (guix packages) #:use-module (guix derivations) #:use-module (guix download) + #:use-module (guix git-download) #:use-module (guix build-system gnu) + #:use-module (guix build-system cargo) #:use-module (gnu packages) #:use-module (gnu packages adns) #:use-module (gnu packages base) @@ -210,3 +212,74 @@ devices.") (sha256 (base32 "16j1rrxkhmvpcw689ndw1raql1gz4jqn7n82z55zn63c05cgz7as")))))) + +(define-public swc + ;; No release yet. + (let ((commit "2e22397f42139247b2c5a6e298482efda4e92176") + (revision "1")) + (package + (name "swc") + (version (string-append "0.0-" revision "." (string-take commit 9))) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/swc-project/swc.git") + (commit commit))) + (file-name (string-append name "-" version "-checkout")) + (sha256 + (base32 + "0jfad6zqrznfy4jhl3sff2h9l38fd2dfz2s9rx7k7wc2n66dzn4s")))) + (build-system cargo-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'permissions + (chmod ".cargo/config" #o755))))) + ;; (native-inputs + ;; `(("pkg-config" ,pkg-config))) + (synopsis "Super-fast ECMAscript compiler written in rust.") + (description "swc is rust port of babel and closure compiler. +It supports the following transforms: + + es3 + member-expression-literals + property-literals + reserved-words + + es2015 + arrow-functions + block-scoped-functions + block-scoping + Note: this might be buggy (at this time) + classes + computed-properties + destructuring + duplicate-keys + for-of + function-name + instanceof + literals + new-target + parameters + shorthand-properties + spread + sticky regex (y flag) + template-literals + typeof-symbol + + es2016 + exponentiation-operator + + es2017 + async-to-generator + + es2018 + object-rest-spread + + react + jsx +") + (home-page "") + (license expat + ;; FIXME license:apache2.0 + )))) -- 2.19.2