My current thoughts on the next major.
Drop Node.js 12
With Node.js v18 going LTS in October, we can drop v12 and shift all version support to the left. v14 will be the new legacy, v16 the new stable, v18 current, and v19? experimental.
Rollup v3
Rollup v3 will be landing shortly: https://twitter.com/lukastaegert/status/1564890445972492288
No more workspaces support
Packemon was initially designed to run from the repo root, and build all packages in the workspace. This has overly complicated the codebase. In v3, Packemon will only build the project with a package.json
in the current directory.
If you need workspaces support, use a package manager or build system that builds across many projects.
No more React rendered output
We use Ink (React) to render a very nice looking terminal output. However, this is much slower than simply running in the background, as it's constantly re-rendering the screen. Instead, we will only log to the console when a package is built.
Ship modules
Since Packemon isn't consumed like a standard library, and is purely ran as a binary, we can ship a full ESM package using .mjs
files. We should see a slight performance gain with this approach.
Merge code and type artifacts
Our current architecture separates code bundling (rollup) and type declaration generation (typescript) into distinct "artifacts", CodeArtifact
and TypesArtifact
respectively. While this made sense in the beginning, it has actually resulted in a much more complicated implementation, as they have no context into each other. This is problematic in regards to exports
generation and entry point resolution.
In v3, these will be merged into a single layer that produces all the outputs in parallel, while keeping context accurate and in sync.
tsconfig.json
automatically inferred
This is the biggest change in v3 that will most likely cause the most disruption. In v2, when generating declarations, Packemon will use the closest tsconfig.json
(or a custom config via --declarationConfig
). For the most part, this made sense and just worked. However, with TypeScript v4.7 and the introduction of .cts
and .mts
files, this approach will no longer work, for the following reason:
If a Packemon package is building multiple formats (for example: cjs
, esm
, lib
), a single tsconfig.json
is no longer applicable, as TS generates different .d.ts
files based on the source file extension. We also now have .d.cts
and .d.mts
files.
Because of this, Packemon will now require a unique tsconfig for each format being built, and will automatically assume the name based on the format. For example, building an esm
package will use tsconfig.esm.json
, and a cts
package will use tsconfig.cts.json
, so on and so forth.
This also means that the dts
folder will go away, as the declarations will now live alongside their compiled files. It also means that builds will get slower the more formats you have, as we are doing N tsc
compilations instead of just one.
Add electron support
I'd say it's about time to support electron. Babel supports it: https://babeljs.io/docs/en/babel-preset-env#browserslist-integration As does swc: https://swc.rs/docs/configuration/supported-browsers#targets
Add debugging
Add a --debug
option that helps debug what's going on.
Disable sourcemaps for Node.js
These aren't really necessary. The new defaults will be:
node - no bundle, no sourcemaps
native - no bundle, sourcemaps
browser - bundle, sourcemaps