[Pkg-javascript-devel] Help: nodejs 16 need node-acorn source to break bootstrapping loop
Pirate Praveen
praveen at onenetbeyond.org
Sun Dec 5 08:20:54 GMT 2021
2021, ഡിസംബർ 3 3:45:33 PM IST, "Jérémy Lal" <kapouer at melix.org>ൽ എഴുതി
>Le ven. 3 déc. 2021 à 10:48, Jonas Smedegaard <jonas at jones.dk> a écrit :
>
>> Quoting Pirate Praveen (2021-12-03 07:17:12)
>> >
>> >
>> > 2021, ഡിസംബർ 3 8:38:53 AM IST, "Jérémy Lal" <kapouer at melix.org>ൽ എഴുതി
>> > >Le ven. 3 déc. 2021 à 04:05, Pirate Praveen <praveen at onenetbeyond.org>
>> a
>> > >écrit :
>> > >
>> > >> 2021, ഡിസംബർ 2 7:22:02 AM IST, "Jérémy Lal" <kapouer at melix.org>ൽ
>> > >> എഴുതി
>> > >> >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> écrit :
>> > >> >> >> 2021, ഡിസംബർ 1 5:18:25 PM IST, "Jérémy Lal"
>> > >> >> >> <kapouer at melix.org>ൽ എഴുതി
>> > >> >> >> >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.
>> > >>
>> > >> OK, thanks for the explanation. We can, may be, file a wishlist
>> > >> issue to support ES modules for internal acorn as well.
>> > >>
>> > >
>> > >If upstream node switches to ES for internal modules, they'll do it
>> > >for all of them i think. But it would not simplify anything, so i
>> > >doubt they wil.
>> >
>> > Why would it not simplify? If nodejs can handle ES6 directly, then we
>> > don't need to build acorn (we can use the esm source directly). So if
>> > acorn don't build depend or depend on nodejs, we break the circular
>> > build dependency.
>>
>> I guess Jérémy means that it would not simplify anything for _upstream_,
>> if (as usual in the NodeJS ecosystem) what they depend on is not sources
>> but products.
>>
>> If that's the point then I think it might still be worth a try to make
>> the suggestion, pointing out benefits for downstrem users like Debian
>> wanting to simplify bootstrappability - even if that's not generally a
>> priority for NodeJS developers upstream.
>>
>
>Maybe we had a misunderstanding:
>i will/am doing precisely that: loading "source" acorn using ESM from
>internal nodejs builtins.
>However that makes nodejs much slower to start - it has to read
>*sequentially* all acorn
>source files (around 20), and in that mode, it has to read all its internal
>builtins ( ~ 260).
>That's 280 files to load on start. Currently all those are packed and
>loaded at once in /usr/bin/node.
>Hence why i want to build a "slow" stage 1 nodejs then the normal build as
>soon as acorn can
>be repacked by rollup.
Do you have some numbers how much time difference is this? Is there some possible optimizations here?
>Jérémy
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
More information about the Pkg-javascript-devel
mailing list