all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Joshua Branson <jbranso@dismail.de>
To: Mekeor Melire <mekeor@posteo.de>
Cc: zamfofex <zamfofex@twdb.moe>,  guix-devel@gnu.org
Subject: Re: bringing npm packages to Guix
Date: Tue, 20 Dec 2022 09:01:24 -0500	[thread overview]
Message-ID: <87cz8ew4wb.fsf@dismail.de> (raw)
In-Reply-To: <87ili6h227.fsf@posteo.de> (Mekeor Melire's message of "Tue, 20 Dec 2022 09:00:16 +0000")

Mekeor Melire <mekeor@posteo.de> 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 when I
>> concluded that it does indeed seem like a very large part of npm is necessary
>> 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, unfortunately, 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 ‘devDependencies’ of a given package are actually
>> necessary to build it. A lot of packages have ‘devDependencies’ for things
>> such as tests and watching the filesystem for changes for ease of development.
>
> Is importing npm-packages into Guix difficult because npm-packages have so 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 build
>> successfully comes down to (optionally) compile TypeScript, then (optionally)
>> perform some kind of bundling or transpilation. And that doesn’t really
>> require TypeScript or a build tool from npm, since esbuild (which is already
>> 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 TypeScript)
> have so many dependencies themselves?
>
> Also, is there a reason to choose esbuild over rust-swc (or vice versa)?
>
>> Now, taking away the ‘devDependencies’ when recursing the 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 to use
>> esbuild ad‐hoc (i.e. in a case-by-case basis), because each package has its
>> own build peculiarities, and esbuild doesn’t acknowledge them. (One solution
>> could be to create an esbuild wrapper that mimics ‘tsc’ 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 <https://esbuild.github.io/api/#tsconfig>.)
>
>> With that approach in mind, I was able to package sucrase as a proof of
>> concept! Note that sucrase doesn’t have a lot of transitive dependencies, so
>> it was easy to just modify the phases of each package in an ad‐hoc way.
>> However, also note that sucrase depends on itself, so I decided to bootstrap
>> it with esbuild, then use the bootstrapped version to build sucrase again.
>> (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.


      reply	other threads:[~2022-12-20 14:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-19 21:27 bringing npm packages to Guix zamfofex
2022-11-21 11:13 ` Ludovic Courtès
2022-11-21 22:52   ` zamfofex
2022-12-20  9:00 ` Mekeor Melire
2022-12-20 14:01   ` Joshua Branson [this message]

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

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

  git send-email \
    --in-reply-to=87cz8ew4wb.fsf@dismail.de \
    --to=jbranso@dismail.de \
    --cc=guix-devel@gnu.org \
    --cc=mekeor@posteo.de \
    --cc=zamfofex@twdb.moe \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.