tres icon indicating copy to clipboard operation
tres copied to clipboard

feat(build): use `tsdown` to build the lib

Open userquin opened this issue 3 months ago • 5 comments

This PR includes:

  • use tsdown to build the lib
  • use relatives paths to import modules, right now there are a few imports using src/** or **/
  • 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)
  • ~~this PR should be breaking:~~ now utils/template-compiler-options not being exported by @tresjs/core => @tresjs/core/template-compiler-options: NOTE: added back templateCompilerOptions to the default subpackage export.
  • removed package.json content from dist/index.js via define: included define in the playground
  • fixed tsconfig.node.json files to allow resolve stuff from the corresponding src/** files
  • update docs to use @tresjs/core from src or dist root folders: current version using @tresjs/core from node_modules (there is some circular dependency with tresjs/cientos and/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 build stuff: the banner moved to the tsdown config file.
  • ✔️ I also need to export TresJSCoreVersion somewhere, maybe at utils and barrel.
  • ✔️ check import.meta.env.MODE at logger module, failing at dev in the docs: not yet sure why still resolving from root dist folder when it should resolve from src root folder, check import.meta.env.MODE error error below => FIXED: we need to add @tresjs/** to build.transpile to avoid interpreting the packages during build
  • ✔️ remove root d.ts files, not needed => using typesVersions
  • add directives to the docs (this must go to another PR)
  • add new section for unimport andunplugin-vue-components (this should go to another PR)
import.meta.env.MODE error import.meta.env.MODE error

@tresjs/core subpackage exports new @tresjs/core subpackage exports

userquin avatar Sep 24 '25 12:09 userquin

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...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Sep 24 '25 12:09 netlify[bot]

Open in StackBlitz

npm i https://pkg.pr.new/@tresjs/core@1094

commit: e25c121

pkg-pr-new[bot] avatar Sep 24 '25 13:09 pkg-pr-new[bot]

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.

userquin avatar Sep 24 '25 14:09 userquin

@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

userquin avatar Sep 24 '25 22:09 userquin

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?

alvarosabu avatar Sep 26 '25 11:09 alvarosabu