Message ID | 20240205231952.26410-2-ngraves@ngraves.fr |
---|---|
State | New |
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id DDC4527BBEC; Mon, 5 Feb 2024 23:22:41 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id F1B9727BBEA for <patchwork@mira.cbaines.net>; Mon, 5 Feb 2024 23:22:40 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces@gnu.org>) id 1rX8Gh-0006Gi-Kh; Mon, 05 Feb 2024 18:20:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1rX8Gf-0006GD-TU for guix-patches@gnu.org; Mon, 05 Feb 2024 18:20:49 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1rX8Gf-0001ox-Lf for guix-patches@gnu.org; Mon, 05 Feb 2024 18:20:49 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1rX8Gs-0003wg-Em for guix-patches@gnu.org; Mon, 05 Feb 2024 18:21:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68941] [PATCH 02/44] guix: build-system: node: Add node-is-type-object helper. Resent-From: Nicolas Graves <ngraves@ngraves.fr> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 05 Feb 2024 23:21:02 +0000 Resent-Message-ID: <handler.68941.B68941.170717521514599@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68941 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68941@debbugs.gnu.org Cc: ngraves@ngraves.fr Received: via spool by 68941-submit@debbugs.gnu.org id=B68941.170717521514599 (code B ref 68941); Mon, 05 Feb 2024 23:21:02 +0000 Received: (at 68941) by debbugs.gnu.org; 5 Feb 2024 23:20:15 +0000 Received: from localhost ([127.0.0.1]:52610 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1rX8G7-0003nO-Ae for submit@debbugs.gnu.org; Mon, 05 Feb 2024 18:20:15 -0500 Received: from 7.mo560.mail-out.ovh.net ([188.165.48.182]:49457) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ngraves@ngraves.fr>) id 1rX8G4-0003n4-OH for 68941@debbugs.gnu.org; Mon, 05 Feb 2024 18:20:13 -0500 Received: from director6.ghost.mail-out.ovh.net (unknown [10.108.25.52]) by mo560.mail-out.ovh.net (Postfix) with ESMTP id 269E925563 for <68941@debbugs.gnu.org>; Mon, 5 Feb 2024 23:19:59 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-f8dts (unknown [10.108.54.148]) by director6.ghost.mail-out.ovh.net (Postfix) with ESMTPS id BC0861FDBC; Mon, 5 Feb 2024 23:19:58 +0000 (UTC) Received: from ngraves.fr ([37.59.142.97]) by ghost-submission-6684bf9d7b-f8dts with ESMTPSA id 2SUDJh5twWVf3ScAEMXqjw (envelope-from <ngraves@ngraves.fr>); Mon, 05 Feb 2024 23:19:58 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-97G002debafd94-0aea-459a-8407-9eb520c97288, 9F372080060396D88D3FD19D164346DC319AC2A4) smtp.auth=ngraves@ngraves.fr X-OVh-ClientIp: 87.88.184.255 Date: Tue, 6 Feb 2024 00:18:50 +0100 Message-ID: <20240205231952.26410-2-ngraves@ngraves.fr> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240205231952.26410-1-ngraves@ngraves.fr> References: <20240205231952.26410-1-ngraves@ngraves.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 7863003478556140258 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrfedvvddgtdelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepteevveffkeeikeffteeviefggefhleeiueejvdduieffhfejieeuleejkeegvdffnecuffhomhgrihhnpehtohhsthhrihhnghdrtggrlhhlnecukfhppeduvdejrddtrddtrddupdekjedrkeekrddukeegrddvheehpdefjedrheelrddugedvrdeljeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqpdhnsggprhgtphhtthhopedupdhrtghpthhtohepieekleegudesuggvsggsuhhgshdrghhnuhdrohhrghdpoffvtefjohhsthepmhhoheeitddpmhhouggvpehsmhhtphhouhht X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Reply-to: Nicolas Graves <ngraves@ngraves.fr> X-ACL-Warn: , Nicolas Graves via Guix-patches <guix-patches@gnu.org> From: Nicolas Graves via Guix-patches via <guix-patches@gnu.org> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches |
Series |
Node : a solution for tiny packages.
|
|
Commit Message
Nicolas Graves
Feb. 5, 2024, 11:18 p.m. UTC
* guix/build-system/node.scm (node-is-type-object): Add function. Change-Id: I7027aff3b314cd999798afd8c11dc90ef7c6e43c --- guix/build-system/node.scm | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
Comments
Am Dienstag, dem 06.02.2024 um 00:18 +0100 schrieb Nicolas Graves: > * guix/build-system/node.scm (node-is-type-object): Add function. > > Change-Id: I7027aff3b314cd999798afd8c11dc90ef7c6e43c > --- > guix/build-system/node.scm | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm > index 8a903b4fe5..b52b8f4f3e 100644 > --- a/guix/build-system/node.scm > +++ b/guix/build-system/node.scm > @@ -35,8 +35,22 @@ (define-module (guix build-system node) > node-build > node-build-system > > + node-is-type-object > node-trivial-package)) > > +(define* (node-is-type-object type #:optional (type-exists? #t)) > + "Helper for node packages replacement. This is actual code > factorized from > +the packages it replaces, use with caution. It doesn't apply to all > +javascript types." Which types are excluded? > + (string-append > + "function(value) {" > + (if type-exists? > + (string-append > + "if (typeof value === '" (string-downcase type) "') {return > true;} ") > + "") > + "if (value === null || typeof value !== 'object') {return false;} > + return Object.prototype.toString.call(value) === '[object " type > "]';}")) > + I'd call this js-type-object? or perhaps make-js-type-predicate. Cheers
On 2024-02-06 20:33, Liliana Marie Prikler wrote: > Am Dienstag, dem 06.02.2024 um 00:18 +0100 schrieb Nicolas Graves: >> * guix/build-system/node.scm (node-is-type-object): Add function. >> >> Change-Id: I7027aff3b314cd999798afd8c11dc90ef7c6e43c >> --- >> guix/build-system/node.scm | 14 ++++++++++++++ >> 1 file changed, 14 insertions(+) >> >> diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm >> index 8a903b4fe5..b52b8f4f3e 100644 >> --- a/guix/build-system/node.scm >> +++ b/guix/build-system/node.scm >> @@ -35,8 +35,22 @@ (define-module (guix build-system node) >> node-build >> node-build-system >> >> + node-is-type-object >> node-trivial-package)) >> >> +(define* (node-is-type-object type #:optional (type-exists? #t)) >> + "Helper for node packages replacement. This is actual code >> factorized from >> +the packages it replaces, use with caution. It doesn't apply to all >> +javascript types." > Which types are excluded? Sorry, I haven't seen your email earlier. Basically all types that I've kept in a true package are in this case. The process was to look the source code to see if we could use this replacement instead. The packages where that was not as straightforward I've simply kept the original packages. This includes for instance : node-is-set, node-is-map, node-is-callable, node-is-symbol... >> + (string-append >> + "function(value) {" >> + (if type-exists? >> + (string-append >> + "if (typeof value === '" (string-downcase type) "') {return >> true;} ") >> + "") >> + "if (value === null || typeof value !== 'object') {return false;} >> + return Object.prototype.toString.call(value) === '[object " type >> "]';}")) >> + > I'd call this js-type-object? or perhaps make-js-type-predicate. I've renamed this make-js-type-predicate. I'm trying to send an extensive v2 that would bootstrap up to node-tape instead of just node-deep-equal. > > Cheers > > >
diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm index 8a903b4fe5..b52b8f4f3e 100644 --- a/guix/build-system/node.scm +++ b/guix/build-system/node.scm @@ -35,8 +35,22 @@ (define-module (guix build-system node) node-build node-build-system + node-is-type-object node-trivial-package)) +(define* (node-is-type-object type #:optional (type-exists? #t)) + "Helper for node packages replacement. This is actual code factorized from +the packages it replaces, use with caution. It doesn't apply to all +javascript types." + (string-append + "function(value) {" + (if type-exists? + (string-append + "if (typeof value === '" (string-downcase type) "') {return true;} ") + "") + "if (value === null || typeof value !== 'object') {return false;} + return Object.prototype.toString.call(value) === '[object " type "]';}")) + (define* (node-trivial-package node-name version replacement description #:key (propagated-inputs '()) (mozilla-doclink #f) ;maybe-string