Ship packages as bundled and untranspiled code
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
The npm packages in the toolkit all ship with non-bundled and heavily transpiled code, for example https://unpkg.com/@actions/cache@1.0.6/lib/cache.js starts like this:
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Using vcc as is recommended by for example the typescript starter example, I end up with a bundle like this (from https://github.com/Swatinem/rust-cache):
> grep "var __awaiter =" dist/save/index.js | wc -l
13
Actions are running on at least node 12 by definition, and they can run async/await code untranspiled. I wonder how much smaller, and faster to execute the final action would be if we could trim out all this unnecessary and duplicated code.
As a contributor to rollup and maintainer of https://github.com/Swatinem/rollup-plugin-dts I could very well whip up something to improve the situation, but I don’t really want my efforts to be in vain, seeing that most of the PRs to this repo go stale and unmerged :-(
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting how the toolkit's npm packages are built and the generated dist/save/index.js mentioned in the issue, along with the TypeScript starter example using vcc. Compare bundled output for duplicated __awaiter helpers and untranspiled async/await. Done means the packages produce smaller, bundled output without unnecessary transpilation, with any relevant size or execution improvements measured.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- build-system
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100