Closed glen-84 closed 3 years ago
@KaelWD Can I send a PR for this?
If you have an idea for it sure, idk how I want to handle these yet.
In the docs, icon and theme stuff is exported via vuetify
, but useDisplay
is exported via vuetify/lib/composables/display
.
Exporting additional things via vuetify
is simple, but exporting via vuetify/lib/composables/*
in your current system appears to require additional createConfig
calls in rollup.config.js
(which doesn't appear to support globbing).
I had started with:
entry.ts
export * from './components'
+export * from './composables'
export * from './directives'
export * from './framework'
composables/index.ts
export { useDisplay } from './display'
export { IconAliases, IconProps, IconSet } from './icons'
export { ThemeDefinition } from './theme'
rollup.config.js
export default [
createConfig('entry.d.ts', 'lib/entry.d.ts'),
createConfig('framework.d.ts', 'lib/framework.d.ts'),
createConfig('entry-bundler.d.ts', 'dist/vuetify.d.ts'),
createConfig('components/index.d.ts', 'lib/components/index.d.ts'),
createConfig('directives/index.d.ts', 'lib/directives/index.d.ts'),
+ createConfig('iconsets/mdi-svg.d.ts', 'lib/iconsets/mdi-svg.d.ts'), // +5 more for the other icon sets.
]
... but then I noticed that useDisplay
wasn't exported directly from vuetify
in the docs, so a decision would need to be made in that regard.
The rollup configuration could get a little bit out-of-control if everything has to be listed manually, especially for things like icon sets where the same names (aliases
, etc.) are being exported so you can't just export from an index (unless you rename the exports so that you can do something like import { mdi, mdiAliases, mdiSvg, mdiSvgAliases } from 'vuetify/iconsets'
).
@KaelWD,
I installed @microsoft/api-extractor@7.18.4
, and added your npm script:
"build:types": "rimraf types-temp && tsc --pretty --emitDeclarationOnly -p tsconfig.dist.json && api-extractor run --local --verbose && rimraf types-temp"
It runs without errors, and the only warnings are things like:
Warning: src/framework.ts:22:1 - (ae-missing-release-tag) "createVuetify" is exported by the package, but it is missing a release tag (
@alpha
,@beta
,@public
, or@internal
)
... which should be easy to fix by just adding /** @public */
(or @alpha
), or by removing the export of symbols that should not be exported.
I made no other changes to the code. Were you seeing other errors? If so, does that mean that everything is fixed, and this is ready to be used?
Could this be an issue, or are you okay with exporting everything from a single entry file?
If you are, then I guess it answers the question about:
import { useDisplay } from 'vuetify/lib/composables/display'
vs
import { useDisplay } from 'vuetify'
... but it would probably require exporting unique names (f.e. in the icon case, where you have multiple aliases
, etc.).
Environment
Vuetify Version: 3.0.0-alpha.8 Vue Version: 3.1.4 Browsers: Chrome 91.0.4472.124 OS: Windows 10
Steps to reproduce
Try to use types like:
IconSet
,IconAliases
,IconProps
(ref)ThemeDefinition
(ref)aliases
,mdi
from"vuetify/lib/iconsets/mdi-svg"
(ref)useDisplay
(ref)Expected Behavior
Types to exist.
Actual Behavior
They don't.
Reproduction Link
n/a
Other comments
It's really quite difficult working with all these missing types. 🙂