[Pkg-javascript-devel] Help: nodejs 16 need node-acorn source to break bootstrapping loop

Jérémy Lal kapouer at melix.org
Thu Dec 2 01:52:02 GMT 2021


Le jeu. 2 déc. 2021 à 02:02, Pirate Praveen <praveen at onenetbeyond.org> a
écrit :

>
>
> 2021, ഡിസംബർ 1 9:52:45 PM IST, "Jérémy Lal" <kapouer at melix.org>ൽ എഴുതി
> >Le mer. 1 déc. 2021 à 16:41, Pirate Praveen <praveen at onenetbeyond.org> a
> >écrit :
> >
> >>
> >>
> >> 2021, ഡിസംബർ 1 5:18:25 PM IST, "Jérémy Lal" <kapouer at melix.org>ൽ എഴുതി
> >> >Hi,
> >> >
> >> >To work around the bootstrapping issue that is posed by the huge loop
> >> >of build-dependencies:
> >> >nodejs -> node-acorn -> rollup -> zillion things -> nodejs,
> >> >it is possible to make a stage 1 nodejs build that loads node-acorn
> >> >*source* files,
> >> >instead of the compiled ones.
> >>
> >> If nodejs 16 can handle acorn source files (ES6) directly, can we just
> >> skip the build of acorn ? So we can drop nodejs build dependency.
> >>
> >
> >yes, it can be skipped, for stage 1 build.
> >But the configuration options used for that build are not supported by
> >upstream
> >for anything else than development, and it has a non-negligible impact on
> >nodejs initial load time.
> >So as soon as node-acorn can be built (by rollup), normal nodejs build
> must
> >be done.
>
> I'm suggesting we ship node-acorn as ES6 source only (remove build steps
> from current node-acorn itself) if our nodejs can handle it. Rollup might
> be needed only for compatibility with older nodejs versions which we don't
> need to support.


Unfortunately, it's not that simple.
Short version: internal acorn *need* to be in commonjs format.

In Node, internal modules are built into a single c file, to allow
a very fast "boot". They are all in CJS format.
The possibility given by Node to load internal modules from a directory
instead, is only there for development purposes (indeed, very handy for
hacking
into internal modules).
I'm using that option to patch (by using internal esm loader to do dynamic
import)
how acorn is loaded by internal modules - but that's not something we want
to keep around in debian. It might have subtle side effects, bugs, and
performance issues.

Adding node-acorn source into nodejs source tarball was made easy
thanks to uscan component support. I have yet to finish the patch for
dynamic import.

Jérémy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-javascript-devel/attachments/20211202/711b6807/attachment.htm>


More information about the Pkg-javascript-devel mailing list