Bug#1005089: [Pkg-javascript-devel] Bug#1005089: nodejs: Add node_modules links to nodejs

2022-02-07 Thread Jérémy Lal
On Mon, Feb 7, 2022 at 8:33 AM Yadd  wrote:

> Package: nodejs
> Version: 16.13.2~dfsg-2
> Severity: normal
>
> Hi,
>
> starting from version 14, nodejs is able to run .mjs files. However,
> "import" method only works when dependency is available in node_modules
> directories. To avoid having to create node_modules/* links in each
> directory, it could be usefull to have node_modules links that points to
> nodejs in each /usr/(share|lib|lib/${DEB_MULTIARCH})/nodejs directory.
>
> Then only some links will be needed when a /usr/share/nodejs file tries
> to "import" a /usr/li/x86_64*/nodejs module.
>
> Alternative: modify nodejs to be able to search "import" modules in
> process.config.variables.node_relative_path
>

I agree these should be added for native modules:
/usr/share/node_modules -> /usr/share/nodejs
and for binary modules:
/usr/lib/$(arch_triplet)/node_modules -> /usr/lib/$(arch_triplet)/nodejs

The case of a binary module importing a native module is trickier.
I think the javascript part of those modules should stay in
/usr/share/nodejs,
and the actual compiled binary file be stored in
/usr/lib/$(arch_triplet)/nodejs.

That way only the "binary loading" paths need a patch - which is expected,
since
debian already is patching nodejs to get the correct paths from arch
triplet.

Jérémy



> Cheers,
> Yadd
>
> --
> Pkg-javascript-devel mailing list
> pkg-javascript-de...@alioth-lists.debian.net
>
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-javascript-devel
>


Bug#1005089: [Pkg-javascript-devel] Bug#1005089: nodejs: Add node_modules links to nodejs

2022-02-06 Thread Yadd

On 07/02/2022 08:29, Yadd wrote:

Package: nodejs
Version: 16.13.2~dfsg-2
Severity: normal

Hi,

starting from version 14, nodejs is able to run .mjs files. However,
"import" method only works when dependency is available in node_modules
directories. To avoid having to create node_modules/* links in each
directory, it could be usefull to have node_modules links that points to
nodejs in each /usr/(share|lib|lib/${DEB_MULTIARCH})/nodejs directory.

Then only some links will be needed when a /usr/share/nodejs file tries
to "import" a /usr/li/x86_64*/nodejs module.

Alternative: modify nodejs to be able to search "import" modules in
process.config.variables.node_relative_path

Cheers,
Yadd


This will also decrease lnks needed by typescript (#930268)