[Pkg-javascript-devel] Update package with new type & api

Jérémy Lal kapouer at melix.org
Tue Mar 29 14:58:40 BST 2022


On Tue, Mar 29, 2022 at 3:54 PM Yadd <yadd at debian.org> wrote:

> Hi all,
>
> some packages, especially those from Sindre Sorhus, changed both:
>   * language from commonjs to ECMA only ("type": "module")
>   * API:
>       const foo = require("foo"); // gives also foo.bar
>     becomes:
>       import { foo, fooBar } from "foo";
>
> I build new node-find-up, node-chalk (exp) and node-globy (exp)
> following this:
>   * build commonjs file using rollup
>   * add an index.cjs file which keeps old and new API
>   * modify package.json to replace "type=module" by an extended "exports"
>
> Since new module is "type=module" then we are sure that no reverse
> dependency will call it using "require" but wanted new behavior. This
> permits to have a transition: node-find-up for example seems usable for
> any reverse dependency. Only package which are built from ECMA but
> wanted old version could have their build broken.
>

Awesome ! The author of these packages is pushing too hard to use es
modules...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-javascript-devel/attachments/20220329/7bbec6c6/attachment.htm>


More information about the Pkg-javascript-devel mailing list