feat(build): use `tsdown` to build the lib
This PR includes:
- use
tsdownto build the lib - use relatives paths to import modules, right now there are a few imports using
src/**or**/ - add
composables,components,directives,types,utilsandtemplate-compiler-options,unimportandunplugin-vue-componentsnew subpackage exports (not just types) => NOTE: useunimportto auto-import components and directives andunplugin-vue-componentsto auto-import components (on Nuxt the is no need for components) - ~~this PR should be breaking:~~ now
utils/template-compiler-optionsnot being exported by@tresjs/core=>@tresjs/core/template-compiler-options: NOTE: added backtemplateCompilerOptionsto the default subpackage export. - removed
package.jsoncontent fromdist/index.jsviadefine: included define in the playground - fixed
tsconfig.node.jsonfiles to allow resolve stuff from the correspondingsrc/**files - update docs to use
@tresjs/corefromsrcordistroot folders: current version using@tresjs/corefromnode_modules(there is some circular dependency withtresjs/cientosand/or@tresjs/leches)
I still need to (maybe @danielroe can help on this :point_down: ):
- ✔️ do some cleanup at root vite.config.ts, removed all
buildstuff: the banner moved to the tsdown config file. - ✔️ I also need to export
TresJSCoreVersionsomewhere, maybe at utils and barrel. - ✔️ check
import.meta.env.MODEat logger module, failing at dev in the docs: not yet sure why still resolving from rootdistfolder when it should resolve fromsrcroot folder, check import.meta.env.MODE error error below => FIXED: we need to add@tresjs/**tobuild.transpileto avoid interpreting the packages during build - ✔️ remove root
d.tsfiles, not needed => usingtypesVersions - add directives to the docs (this must go to another PR)
- add new section for
unimportandunplugin-vue-components(this should go to another PR)
import.meta.env.MODE error
@tresjs/core subpackage exports
Deploy Preview for tresjs-docs ready!
| Name | Link |
|---|---|
| Latest commit | e25c1212acbdc190f978ccfb0e8fba4ae4f3bceb |
| Latest deploy log | https://app.netlify.com/projects/tresjs-docs/deploys/68d67669ac35500008edd828 |
| Deploy Preview | https://deploy-preview-1094--tresjs-docs.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
There is some circular dependency, docs using @tresjs/core from node_modules, I just added some hack to resolve the package from src (dev/build/prepare commands) or dist (typecheck command) root folders.
@alvarosabu we should check prefixes at unimport and unplugin-vue-components, we need to check there is no collision with other @tresjs/** packages, maybe instead Tres prefix we can use TresCore: useXXX => useTresCoreXXX for composables and for directives at unplugin-vue-components
Hi @userquin thanks for taking the time, as always, to help us out here with the Typescript nightmare 🙈
I'd love to better understand the core motivation behind these changes. Are we primarily addressing the Node16 moduleResolution issues shown in https://arethetypeswrong.github.io/?p=@tresjs/[email protected]?
I notice we're tackling three different areas simultaneously 😅, which makes it harder to evaluate each change independently. Could we potentially break this into separate PRs to make review and testing more manageable?
- Updating to tsdown
- Subpackage exports
- DX improvements with auto-import
add composables, components, directives, types, utils and template-compiler-options, unimport and unplugin-vue-components new subpackage exports (not just types) => NOTE: use unimport to auto-import components and directives and unplugin-vue-components to auto-import components (on Nuxt the is no need for components)
Regarding the barrel exports, this might have been something we should have addressed in V5. I'm wondering if anyone is actually using these additional exports, as they seem to create maintenance overhead.. @userquin Are the components and composables exports necessary for the Nuxt module to work correctly?