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 ms5.migadu.com with LMTPS id yP6cCoXBoWMYBAEAbAwnHQ (envelope-from ) for ; Tue, 20 Dec 2022 15:07:01 +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 OFenCoXBoWNWHAAA9RJhRA (envelope-from ) for ; Tue, 20 Dec 2022 15:07:01 +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 025F420543 for ; Tue, 20 Dec 2022 15:07:00 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7dBs-0005Dc-37; Tue, 20 Dec 2022 09:02:01 -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 ) id 1p7dBY-0005B3-Qx for guix-devel@gnu.org; Tue, 20 Dec 2022 09:01:38 -0500 Received: from mx1.dismail.de ([78.46.223.134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7dBU-0002RZ-SL for guix-devel@gnu.org; Tue, 20 Dec 2022 09:01:35 -0500 Received: from mx1.dismail.de (localhost [127.0.0.1]) by mx1.dismail.de (OpenSMTPD) with ESMTP id e80837ac; Tue, 20 Dec 2022 15:01:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=dismail.de; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version :content-type:content-transfer-encoding; s=20190914; bh=UcOxEdYj zYKFRgfbVTAeT5Bbh7yRwLzUmorZqDlR9P4=; b=fgKLJk6migDOpICWroT0EB/G G+ifdZ54JAOi1PZUXGSHOTMI2HBKaHb4qqCv3wCEPe6y9IEUmyAKZAr//IhnSSJ2 UVk8K3ytSTc/5ocOTqUWDfys/z0lxETdUrDHtN0ciPlFZi4bG8l0qWXZYU/USBFJ /Pw2903fEOrQUcvocZEEbkSwOC9QkoIAEPY8ogaFv1fUesvQ4TJ3h+VK2Gs3RiDB QpY/+7dcTpiKP+iYv6cmIO9th9vzAoUp4qCx3C2y5yVagCKPV03Xy7Z5NnbMCpKX eRzxJLpBJXZN7gHl/TOh0YtavALMGNsweb8hOrzYAqSvatapkmQ+ucuZTYX/cw== Received: from smtp2.dismail.de ( [10.240.26.12]) by mx1.dismail.de (OpenSMTPD) with ESMTP id b17a6431; Tue, 20 Dec 2022 15:01:27 +0100 (CET) Received: from smtp2.dismail.de (localhost [127.0.0.1]) by smtp2.dismail.de (OpenSMTPD) with ESMTP id 6476f122; Tue, 20 Dec 2022 15:01:27 +0100 (CET) Received: by dismail.de (OpenSMTPD) with ESMTPSA id ab4cad81 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 20 Dec 2022 15:01:26 +0100 (CET) From: Joshua Branson To: Mekeor Melire Cc: zamfofex , guix-devel@gnu.org Subject: Re: bringing npm packages to Guix In-Reply-To: <87ili6h227.fsf@posteo.de> (Mekeor Melire's message of "Tue, 20 Dec 2022 09:00:16 +0000") References: <450401139.631101.1668893228599@privateemail.com> <87ili6h227.fsf@posteo.de> X-Gnus-Sucks: I know man Date: Tue, 20 Dec 2022 09:01:24 -0500 Message-ID: <87cz8ew4wb.fsf@dismail.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=78.46.223.134; envelope-from=jbranso@dismail.de; helo=mx1.dismail.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=dismail.de header.s=20190914 header.b=fgKLJk6m; dmarc=pass (policy=reject) header.from=dismail.de; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1671545221; a=rsa-sha256; cv=none; b=iFsS1JLw7pjAi6//KzMnK3gu1YJUJb+sDrEfVzOgcyBH5snhQMbipnRzHEUFbLcNoT6rec /oJ80ysHnDjvEAaKJGTpNGvBjy1QOD5Co2/IcFs3S4rEAF5zh6/G/voG1pWJQuhZ4deq5e ex0Lik1Njs/iGBDp1c2hV7Mn3EbaLuipmSgjTPJ2GKGC7S/ZYM2Aa/Q0GLAbWHtVe0LgdZ SGeVyV9tHEupkLO7rH8PHCE67RRtbB8TA2Vojb9SHha/vvqSRvnBPDXr0qS98FLMvy/WaX 0/8VHnkUCHXQPM1PjxcP7tXF0lxfqV3f0jSfrue13fgXPoGmDT6dky70dAp+BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1671545221; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=f3UuO1hQEfi+cgnXzNZrgVb0KeUnjBxsnD4BL6qpPlc=; b=TSixY4g6mLM/MO2OHde7ZlZ6wz9Orueizgdj5+Bd23IHi/eQ2doDMUsdXK9Doh9Jug5GBG Wb2XgQy3MneM+p6dyBDMh96IgO7RRBUVGy+Z/SUVKwnJ475Lf/adiu6AQDHO2sE/h+qMgb l3f6cAcK/KtqPokKUQYqlcOyro1oIwlBoefngEylcCv4cboRaRK/V7eKyTjIfdCl8xZS6w E8+zcC/MN3HW8rwJsmTQJxCCug+7NoeCDbfpsrwVJgh1PgS0IYVNJm+7KYmwId684o2ES/ UObYR4/o/E6dsxVZffIBr9TifRBHrBmy8cCMXkfMo9WbXNCoAXEhAul4z+XrXg== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=dismail.de header.s=20190914 header.b=fgKLJk6m; dmarc=pass (policy=reject) header.from=dismail.de; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -7.35 X-Spam-Score: -7.35 X-Migadu-Queue-Id: 025F420543 X-TUID: R4oaSYK3fspv Mekeor Melire writes: > 2022-11-19 18:27 zamfofex@twdb.moe: > >> Hello, Guix! > > Hello :) > >> A few months ago, I picked up the work towards importing npm packages to= Guix >> by Jelle et al. in the hopes of continuing it, and I felt disheartened w= hen I >> concluded that it does indeed seem like a very large part of npm is nece= ssary >> to build even a simple package like jQuery. > > Thanks for bringing this back up! > > Although, I work with the node/npm ecosystem on a daily basis, unfortunat= ely, I > don't really understand why it's so difficult to import npm-packages into= Guix. > >> But, recently, I decided to spend some more time thinking about it, and I >> realized that not all of the =E2=80=98devDependencies=E2=80=99 of a give= n package are actually >> necessary to build it. A lot of packages have =E2=80=98devDependencies= =E2=80=99 for things >> such as tests and watching the filesystem for changes for ease of develo= pment. > > Is importing npm-packages into Guix difficult because npm-packages have s= o many > dependencies? > Yes. The recursive javascript importer that was written, generates package definitions that are larger than the source code for the packages. It's quite a hairy problem. >> If you think about it, what the vast majority of npm packages need to bu= ild >> successfully comes down to (optionally) compile TypeScript, then (option= ally) >> perform some kind of bundling or transpilation. And that doesn=E2=80=99t= really >> require TypeScript or a build tool from npm, since esbuild (which is alr= eady >> packaged) can do both of those things by itself. > > Is importing npm-packages into Guix so difficult because we have a > chicken-and-egg problem, since many build-time dependencies (like TypeScr= ipt) > have so many dependencies themselves? > > Also, is there a reason to choose esbuild over rust-swc (or vice versa)? > >> Now, taking away the =E2=80=98devDependencies=E2=80=99 when recursing th= e dependency tree >> makes the whole endeavor of importing an npm package seem *much less* >> difficult and scary! The biggest unfortunate issue is that for packages = with a >> build step (TypeScript and/or bundling+transpilation), it is necessary t= o use >> esbuild ad=E2=80=90hoc (i.e. in a case-by-case basis), because each pack= age has its >> own build peculiarities, and esbuild doesn=E2=80=99t acknowledge them. (= One solution >> could be to create an esbuild wrapper that mimics =E2=80=98tsc=E2=80=99 = and other tools.) > > Could we also build TSC with Esbuild, and then use TSC to build packages = that > depend on it, instead of mimicking TSC with Esbuild? Does that make sense? > > With "mimicking TSC", do you mean that Esbuild does not transpile multiple > .ts-files at once? (By the way, Esbuild seems to make use of the tsconfig= .json > file, according to .) > >> With that approach in mind, I was able to package sucrase as a proof of >> concept! Note that sucrase doesn=E2=80=99t have a lot of transitive depe= ndencies, so >> it was easy to just modify the phases of each package in an ad=E2=80=90h= oc way. >> However, also note that sucrase depends on itself, so I decided to boots= trap >> it with esbuild, then use the bootstrapped version to build sucrase agai= n. >> (The bootstrapped sucrase seems to also work as expected!) > > That's so great! > > Sorry for asking nooby questions. I just want to catch up and press ahead= with > the discussion.