From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id CBvWC4eYBWKNSgEAgWs5BA (envelope-from ) for ; Thu, 10 Feb 2022 23:58:15 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id mI8kCYeYBWJaGgEA9RJhRA (envelope-from ) for ; Thu, 10 Feb 2022 23:58:15 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B68632FD5D for ; Thu, 10 Feb 2022 23:58:14 +0100 (CET) Received: from localhost ([::1]:43646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nIIOD-00037k-Uv for larch@yhetil.org; Thu, 10 Feb 2022 17:58:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nIIMG-0007ng-LC for guix-patches@gnu.org; Thu, 10 Feb 2022 17:56:12 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35440) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nIIME-0006KX-0S for guix-patches@gnu.org; Thu, 10 Feb 2022 17:56:10 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nIIMD-0000zG-Vw for guix-patches@gnu.org; Thu, 10 Feb 2022 17:56:09 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [WIP PATCH v3 19/26] gnu: Add tree-sitter-typescript. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 10 Feb 2022 22:56:09 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49946 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49946@debbugs.gnu.org Cc: Pierre Langlois Received: via spool by 49946-submit@debbugs.gnu.org id=B49946.16445337673734 (code B ref 49946); Thu, 10 Feb 2022 22:56:09 +0000 Received: (at 49946) by debbugs.gnu.org; 10 Feb 2022 22:56:07 +0000 Received: from localhost ([127.0.0.1]:57555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nIIMA-0000xx-M9 for submit@debbugs.gnu.org; Thu, 10 Feb 2022 17:56:07 -0500 Received: from mout.gmx.net ([212.227.17.22]:42671) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nIILm-0000sF-85 for 49946@debbugs.gnu.org; Thu, 10 Feb 2022 17:55:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644533736; bh=g25eRCWSkZIbsY50HnVa75JdR9uIEUXO4W4z3wNRbSw=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=IIMRHM2lJD4BgMzf8OAZfW61t3IoVJyvx2coqEqxaoxQfV5E01PspM7AAKj4R4aSb AwfdL/tNcpQiQDs7zE039GcZeRHKHnMWOnooyMbl78kZkj6lhWGp7sTEel6+0LNQ98 imxB837FKCrfQZu1nkHbo/BhrJcGjZnZoGqG5aWk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([82.69.64.142]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MN5eX-1nYa9F1X3F-00J4R0; Thu, 10 Feb 2022 23:55:36 +0100 From: Pierre Langlois Date: Thu, 10 Feb 2022 22:55:20 +0000 Message-Id: <20220210225527.25189-19-pierre.langlois@gmx.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220210225527.25189-1-pierre.langlois@gmx.com> References: <87leyinxly.fsf@gmx.com> <20220210225527.25189-1-pierre.langlois@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:mBss4GrX76xSO2luVyo5H3Bhl7sKLBEZm5HwLSbltJkyjv7zBcr oFqM1l4FMgKGvEhSPLQbysqIavTEmkkAuG2j+7PSz75s0JfTFRRLSr9x29Jzww7Vot6+WYR GdiuZVNSAwfkgxemERojIeKA0CpCGVs2VZvHPAC5IfX4B35APQYaN1/yn6i6NF5Lwo0d6u1 RwdjNMfp9zStZk9D+pcSA== X-UI-Out-Filterresults: notjunk:1;V03:K0:ieK+/+uQtEM=:d9nyDqaG287C+XKeVm3G4g YR7hr8czRckMTaLm2xE2ZNWdYPpcukSw1SbadQJQHRdcVxZWpR4A+fBKoQxmGduMnHOzZOgJW kugpSsBEKamzOnXSc3oSIVoZ7y78xqMl9xT16Uk4ALYTSs3/n1Br+hesZVkTYYKi7kd+bnDHC cofdthL2D38Y3OwX8Z1U+QeaEhtkw2nRVQ3ashNudKXVqIdST/9Y3p855CTQna+a/rQIiHwrT yf6qSFLeigO3hVilt6x8BIMfJ2xJyKv0uIpkdQT83y9/plpjndSWUzd/t0zZia3HbB2WN1QP4 DmxFU+cDSg0PTUAj/mg2k1mLTzFyWZbN66u2q/cvR3YEYMIErJ9u1IOSQY3FKdxR2qaOfGzEq r1ccYrQ6KN509LMxU4IwZi664bCpP3KtukxjUKBtZvW0tdJA6Yd4NrbPS+lIk6TCcQuk27ebG Ft0/UEOj+0MCY0c5fy+8JPWdHDXbDDnWpYAui5A3e6663NakY279bFVdGrfiJUO3rCXSB/0FE vUXk45KRuwc53IHrvJvfNpLvdWRVIdSKJXB8UDgU1RX2YjXDsh5fLErD+eXRmRhjXZAQJcbha KibstpPt0ywrrkCbpdFZ68lRpNn+v8fXNZ2cicKdwgkRRxCYlZwl7wi2FxLBzWVfgdy+ic4X/ ytS2FhwMbzXM/IZm/E/cv1jrxoYhGJ1Pw1M9YYSqpMZEgnP2oTNjVZUJYwdw3N5KumOv5yAkl gge0yALJamEg3MccwReZ51GlAJl8AsBUM8YUu4+iwqii4A7+TRV5/JYvd3cjYjbgzLSVqhNLg oA6G9a08bx9snygpWWfgCYrHGRh0iPdbOUPTnSx2kWVTjdHpTXF8mQGljDjLypzcgwN8oDo6U 1dIOO7rpaQZESvKnYi1+Pg2GMZwnK//uRxxZ26okV4Qz+7WvRjqnnpvqD3jswoDy2BrBNjLW+ 1Jx+9YhGMI3WRZ3TuZfSdwzZhs0mHO/hjYUDXj69nMG1o66kQvB0jpujm3/K7tLxt0XgLgsMH raM55knIscBxPyrnt9a1p34Ji6UDvxdONWmJmVqgDq4STQrTe3MrOkLWf5lctcgZGonNet3HT Nb05WECsIUafCI= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644533894; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=T+eEGHSiq5m1rwws37JNkXoTRx39V+A8h3KEvNuGeg0=; b=MqT6OBPrNa2Lk5a7NPQdBxCeFRU//OpR5pqz7Vxh42duooGOFXX0/d1wgtUKwblDE/Qfnc GCT8QnxFMUfmHb1ORK1nA6xEVU/5yJ/XsF7DO1VBdwEUn+oWzOGiPMIUqnVNsfsHEvGMC4 vVcMGZdXQ+bWJXmyNxJu15OJ7zGk2yrseJmsiI7PJWs0JLNpi/7kCOrsnc9GDPJQSkdBWG hnX8ruoglPwM2t+pM0cMWuxI8N+PyJAt9QyIutVswRr9E0N2tZ1uksygE01uTE2fpSbfxp aSi1iWrxlchh3FkDF8KFBkpW69MkKnxtaE5VzbtauUXxH37Juf1H1Hsjo5QcJg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644533894; a=rsa-sha256; cv=none; b=HUmrooa8BRykeU/RRPXlw5QQ0urvsS09ZT5CSmLcQME8G19HBe5pSwCGT3q7bJR7rsxBOb I6Q+LARH/rRMgX0/jGw2XWhp/gmK43f/2JgQnG79pMOKBE10pElOF3GmPQ15mWGY38k4zv ILfnZDnPXDAn8Hdr0AKUWo0wABHu6W23m0YdhwjLHUDG49l2EQTkwT0btz0rZEaNmyXxVU 5jirTa5e+TwKc2efPMvVkdNWk7aRT2B1xOJz0UYmLMCbqXKi/Di5r3R+AM1gGwGu/x/S5b 6JFfIGIZhrLvBJzd+dFJ/wWWOwJY70909VcBEw4iHvs4RsMZ6hdG+PRBaWAgiQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=IIMRHM2l; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmx.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -0.63 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=IIMRHM2l; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmx.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: B68632FD5D X-Spam-Score: -0.63 X-Migadu-Scanner: scn1.migadu.com X-TUID: 2AOeKg+crlPE * gnu/packages/tree-sitter.scm (tree-sitter-typescript): New variable. =2D-- gnu/packages/tree-sitter.scm | 87 ++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm index 63e558f50f..2dcf4dae87 100644 =2D-- a/gnu/packages/tree-sitter.scm +++ b/gnu/packages/tree-sitter.scm @@ -488,3 +488,90 @@ (define-public tree-sitter-rust (description "This package provides a Rust grammar for the Tree-sitter library."= ) (license license:expat))) + +(define-public tree-sitter-typescript + (let ((commit "111b07762e86efab9a918b7c721f720c37e76b0a") + (revision "1")) + (package (inherit tree-sitter-c) + (name "tree-sitter-typescript") + (version (git-version "0.20.0" revision commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/tree-sitter/tree-sitter-ty= pescript") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1364bm3wbqqzvp03cvpx1w89bbqynb1v62i46gy7f6rhib9= bf63a")) + (modules '((guix build utils))) + (snippet + '(begin + (for-each + (lambda (lang) + (with-directory-excursion lang + (delete-file "src/grammar.json") + (delete-file "src/node-types.json") + (delete-file "src/parser.c") + (delete-file-recursively "src/tree_sitter"))) + '("typescript" "tsx")) + #t)))) + (inputs + (list node-nan + `(,tree-sitter-javascript "js"))) + (arguments + (substitute-keyword-arguments (package-arguments tree-sitter-c) + ((#:phases phases) + #~(modify-phases #$phases + ;; The parse-example script tries to clone git repositories. + (add-after 'unpack 'remove-parse-example + (lambda _ + (substitute* "package.json" + ((" && script\\/parse-examples") "")))) + (add-after 'build 'build-gyp + (lambda* (#:key inputs #:allow-other-keys) + (invoke + (search-input-file + inputs + "/lib/node_modules/npm/bin/node-gyp-bin/node-gyp") + "build"))) + (replace 'tree-sitter-generate + (lambda _ + (for-each (lambda (dir) + (with-directory-excursion dir + (invoke "tree-sitter" "generate"))) + '("typescript" "tsx")))) + (replace 'build-and-install-lib + (lambda* (#:key outputs #:allow-other-keys) + (use-modules (guix build json)) + (let ((name (assoc-ref + (call-with-input-file "package.json" read-j= son) + "name")) + (lib (string-append #$output "/lib/tree-sitter/"))= ) + (mkdir-p lib) + (define (source-file? basename) + "document me" + (let ((path (string-append src "/" basename))) + (if (file-exists? path) + path + #f))) + (for-each + (lambda (lang) + (let ((src (string-append #$output:js + "/lib/node_modules/" + name "/" lang "/src"))) + (invoke #$(cc-for-target) + "-shared" + "-fPIC" + "-fno-exceptions" + "-O2" + "-g" + "-o" (string-append lib "/" lang ".so") + (string-append src "/scanner.c") + (string-append src "/parser.c")))) + '("typescript" "tsx"))))))))) + (home-page "https://github.com/tree-sitter/tree-sitter-typescript") + (synopsis "Tree-sitter Typescript grammar") + (description + "This package provides Typescript and TSX grammars for the Tree-s= itter +library.") + (license license:expat)))) =2D- 2.34.0