Skip to content

0.5.0: The ESM Update

Compare
Choose a tag to compare
@Cykelero Cykelero released this 29 Jun 18:34
· 16 commits to main since this release

Finally in Tasklemon: ESM package support!
More and more Node packages are not only adding support for ESM imports, but also removing their CommonJS support—this meant you couldn't use them with Tasklemon anymore.

With Tasklemon 0.5.0, you can now use ESM packages, exactly as you'd use CommonJS packages:

cli.tell(npm.chalk.yellow("lemons") + ", please!");

A package's default export is exposed directly (for instance, as npm.camelcase), and named exports are exposed as nested properties (for instance, npm.uuid.validate). And the same syntax falls back to CommonJS when appropriate.

In the majority of cases, this is all you need! For more in-depth info, see the npm documentation.

New

  • Add ESM support to npm
    • Access both default exports and named exports
    • Transparently fall back to CommonJS exports
    • Still no need to await module loading
  • Add --no-msg Tasklemon argument for muting info messages (loading indicators, deprecation warnings)

Improvements

  • Package preparation process now outputs some errors to preparePackageCacheBundle.errors.log, in the Tasklemon installation folder

Breaking changes

Simply updating Tasklemon through npm does not change the behavior of your scripts. When running a script, its runtime header determines the behavior of the Tasklemon runtime, to ensure consistency across Tasklemon versions.

  • When a package uses both ESM and CommonJS, Tasklemon now favors ESM exports. This can affect the behavior of existing scripts, if a package behaves differently depending on how you import its functionality.