Skip to content

v2.0.0

Compare
Choose a tag to compare
@wessberg wessberg released this 29 May 20:50
· 17 commits to master since this release

New Features

The cjstoesm package is now based on ESM and requires Node v14.19.0 (BREAKING CHANGE)

Despite being a tool for converting CommonJS to ESM, and a bit ironically, cjstoesm has been published as an NPM package with a CommonJS entrypoint (dist/cjs/index.js), and an ESM entrypoint (dist/esm/index.js), while the CLI itself was CommonJS based.

Now, the cjstoesm package is fully based on ESM. There are still API entrypoints for CommonJS using the package exports feature, as well as pointed to from the main field in the package.json.

From this new major version of cjstoesm, you must be using Node.js v14.19.0 or newer.

Improve emit behavior

No more replication of source folder structure (BREAKING CHANGE)

In the past, cjstoesm would replicate the source folder structure inside the destination folder.
For example, if you called to CLI with something like:

cjstoesm foo/bar/baz/** target

You would get files following a pattern like this: target/foo/bar/baz/<filename>.
This was a bit counterintuitive.

In the new version, this behavior changes and aligns with general user expectations. In the example above, from the new version files will follow a pattern like this: target/<filename>.

Allow overwriting in-place and make outDir an optional argument (BREAKING CHANGE)

In the old version of cjstoesm, passing in an output directory was strictly required. From the new version, the default behavior is to simply overwrite the files in-place. You can still pass in a separate output directory as the second argument if you want, but from the new version this is completely optional.

This means that the following is now possible:

cjstoesm **/*.*

Easier globbing

In the old version of cjstoesm, the following wouldn't work:

cjstoesm src

Since src doesn't match anything as a glob. However, to align with user expectations, in the new version, any direct descendent of the src folder will now be matched by the above command.

  • feat: migrate to publishing ES-modules with a CommonJS fallback. Improve emit-behavior. Fix bugs related to inclusion of module specifiers 78592d0

v1.1.5...v2.0.0