The child package manager will be rewritten in TypeScript


Yarn, a JavaScript package manager seen as a rival to NPM, will be rewritten in TypeScript and become API-centric, as part of a comprehensive plan to make the tool more modular, extensible, and developer-friendly.

The builders of Yarn, who want it to become a “development first” tool in 2019, focus on a “plug ‘n’ play” concept that allows Yarn to tell developers where to find packages dependent instead of relying on Node. Wire builders refer to the list of planned changes as “Berry,” with a stable release with improvements coming this summer.

The feed turns into TypeScript

The Yarn development roadmap for version 2 and later calls for the port of the Yarn codebase from Flow to TypeScript, Microsoft’s typed superset of JavaScript, in 2019. This goal is intended to help the community to develop Yarn and create new features.

The roadmap also cites plug-in support as a major change. Yarn plugins will be able to change features ranging from adding new commands to adding support for new package sources or installation targets. Plug-in support will also impact the troubleshooting, recovery, and binding steps.

In a move related to the plug-in system, Yarn will become an API as much as a CLI, with internal components divided into modular entities – a goal also planned for 2019. There will be no further need to analyze package.json because Yarn will ignore this task.

Another goal is for Yarn to support different targets than Node. Developers interested in implementing PHP, Python, or Ruby package installers without leaving Yarn are encouraged to open an issue on this.

There are also plans to make Yarn’s lock file and configuration format a strict subset of the YAML data serialization standard. The information in the lock file will be modified to reflect the long awaited changes such as the removal of host names, allowing easier change of the default registry.

Yarn Roadmap Details

Other major changes and new features on the Yarn roadmap:

  • A redesign of the logging system, including exploitation of TypeScript diagnostic error codes. Errors and warnings will be assigned a unique code.
  • Essential features such as autoclean will be moved into contrib plug-ins.
  • The cache file format will be switched from Tar to Zip, providing better characteristics for random access.
  • Out-of-the-box support for nested workspaces, where a workspace defines additional workspaces. This will expand the uses, especially when used with Git submodules.
  • A resolution protocol, workspaces:, to force the Package Manager to link a package to a workspace, preventing accidental use of a version of a package acquired from the remote registry.
  • A yarn constraints command to apply constraints across packages.
  • Thread link the order will keep the changes in package.json files. Linked packages will resolve dependencies between peers.
  • Writing Posix commands in the scripts field will work regardless of the underlying operating system.
  • Scripts can put arguments anywhere on the command line.
  • The cache will be fully atomic, with multiple Yarn instances able to run simultaneously on the same cache without the risk of corrupting data.

Support for nodes 4 and 6 will be discontinued. In addition, a large number of bugs should go away as the code base is modernized.

The Yarn roadmap is prefaced with remarks about how the landscape has changed since the project began in 2016. Package locking was not a first-class citizen in the JavaScript ecosystem at the time, d ‘a part. Yarn was developed as part of a collaboration between Facebook, Google, Exponent and Tilde.

You can download Yarn from the project website.

Copyright © 2019 IDG Communications, Inc.


Comments are closed.