Deprecate `td.function` in favor of `td.func`
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, rollup, webpack
- Domain
- api, build-system, documentation
Research direction
Start by tracing the current package exports and build setup, then compare how webpack, Rollup, and Browserify handle the proposed ES-module and CommonJS shapes. Done means preserving the intended top-level distribution API and tree shaking, documenting td.func(), and deciding when td.function should be removed in a major release.
Written by the indexing model from the issue text.
Description
Terrible luck to discover this after releasing 2.0.0, but subsequent improvements to the build have made me realize that the cute way we do this:
module.exports = { function: require('./function') /*...*/ }
Just won't fly in ES module-land, where something like this:
export { function }
Will blow up because it's a reserved word. (import {function} from 'testdouble' also blows up)
We can do:
export default {
function: tdFunction
}
But then any module/bundler like webpack/rollup/browserify is going to have that default tacked onto it, which means that our distribution will be td.default.object or whatever.
I hope we can find some workaround to use ES exports exclusively and then solve this with build cleverness using one of the bundlers, but even if we do manage, having a top-level API that's a reserved word is probably not a great long-term play.
Goals:
- hack up some short-term win with a bundler that'll let us still get tree shaking while using a CJS export at the top level or a way to modify the bundled content to
td = td.defaultdynamically. - documentation change from
td.function()totd.func() - figure out how soon we want to think about dropping
td.functionwith another major bump.
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 140
- Avg merge
- 22h
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
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.
More from testdouble/testdouble.js
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
testdouble/testdouble.js#538 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
testdouble/testdouble.js#537 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
testdouble/testdouble.js#536 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
testdouble/testdouble.js#534 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 45/100
testdouble/testdouble.js#533 ·
All issues in testdouble/testdouble.js
Similar issues
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100