From a94b11b412007d662c845f107b01fbe288940f67 Mon Sep 17 00:00:00 2001 From: Yuchao Wu Date: Mon, 6 Mar 2023 09:58:33 +1100 Subject: [PATCH 1/8] Add script config --- packages/vuetify/dev/shim.d.ts | 11 +++++++++++ packages/vuetify/package.json | 1 + packages/vuetify/tsconfig.dev.json | 8 +++++++- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 packages/vuetify/dev/shim.d.ts diff --git a/packages/vuetify/dev/shim.d.ts b/packages/vuetify/dev/shim.d.ts new file mode 100644 index 00000000000..76b167d86fd --- /dev/null +++ b/packages/vuetify/dev/shim.d.ts @@ -0,0 +1,11 @@ +import { VCol } from 'vuetify/src/components/VGrid/VCol' +import { VRow } from 'vuetify/src/components/VGrid/VRow' +import { VBtn } from 'vuetify/src/components/VBtn/VBtn' + +declare module 'vue' { + export interface GlobalComponents { + VCol: typeof VCol; + VRow: typeof VRow; + VBtn: typeof VBtn; + } +} \ No newline at end of file diff --git a/packages/vuetify/package.json b/packages/vuetify/package.json index 0249a12f457..56cc58087d5 100755 --- a/packages/vuetify/package.json +++ b/packages/vuetify/package.json @@ -93,6 +93,7 @@ "dev": "cross-env NODE_ENV=development vite", "dev:ssr": "cross-env NODE_ENV=development VITE_SSR=true vite-ssr", "dev:prod": "concurrently \"cross-env NODE_ENV=production vite build -w\" \"vite preview\"", + "dev:typecheck": "vue-tsc --noEmit --skipLibCheck --project ./tsconfig.dev.json", "build": "rimraf lib dist && concurrently \"yarn build:dist\" \"yarn build:lib\" -n \"dist,lib\" --kill-others-on-fail -r && yarn build:types", "build:dist": "rollup --config build/rollup.config.js", "build:lib": "cross-env NODE_ENV=lib babel src --out-dir lib --source-maps --extensions \".ts\",\".tsx\",\".snap\" --copy-files --no-copy-ignored --out-file-extension .mjs", diff --git a/packages/vuetify/tsconfig.dev.json b/packages/vuetify/tsconfig.dev.json index e5dd2c17fc9..c4fcb09e39e 100644 --- a/packages/vuetify/tsconfig.dev.json +++ b/packages/vuetify/tsconfig.dev.json @@ -4,5 +4,11 @@ "src", "dev", "cypress" - ] + ], + "compilerOptions": { + "allowJs": true + }, + "vueCompilerOptions": { + "strictTemplates": true + } } From aad204469a77df7b5f038cc058e1f62e22485f62 Mon Sep 17 00:00:00 2001 From: Yuchao Wu Date: Wed, 8 Mar 2023 14:23:27 +1100 Subject: [PATCH 2/8] use unplugin-vue-components to generate components.d.ts --- packages/vuetify/dev/components.d.ts | 17 +++++++++++++++++ packages/vuetify/dev/shim.d.ts | 11 ----------- packages/vuetify/vite.config.mjs | 4 ++-- 3 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 packages/vuetify/dev/components.d.ts delete mode 100644 packages/vuetify/dev/shim.d.ts diff --git a/packages/vuetify/dev/components.d.ts b/packages/vuetify/dev/components.d.ts new file mode 100644 index 00000000000..7942261a49b --- /dev/null +++ b/packages/vuetify/dev/components.d.ts @@ -0,0 +1,17 @@ +// generated by unplugin-vue-components +// We suggest you to commit this file into source control +// Read more: https://github.com/vuejs/core/pull/3399 +import '@vue/runtime-core' + +declare module '@vue/runtime-core' { + export interface GlobalComponents { + RouterLink: typeof import('vue-router')['RouterLink'] + RouterView: typeof import('vue-router')['RouterView'] + VApp: typeof import('@/components/VApp')['VApp'] + VAutocomplete: typeof import('@/components/VAutocomplete')['VAutocomplete'] + VBtn: typeof import('@/components/VBtn')['VBtn'] + VMain: typeof import('@/components/VMain')['VMain'] + } +} + +export {} diff --git a/packages/vuetify/dev/shim.d.ts b/packages/vuetify/dev/shim.d.ts deleted file mode 100644 index 76b167d86fd..00000000000 --- a/packages/vuetify/dev/shim.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { VCol } from 'vuetify/src/components/VGrid/VCol' -import { VRow } from 'vuetify/src/components/VGrid/VRow' -import { VBtn } from 'vuetify/src/components/VBtn/VBtn' - -declare module 'vue' { - export interface GlobalComponents { - VCol: typeof VCol; - VRow: typeof VRow; - VBtn: typeof VBtn; - } -} \ No newline at end of file diff --git a/packages/vuetify/vite.config.mjs b/packages/vuetify/vite.config.mjs index 12245b4ece4..34370850f78 100644 --- a/packages/vuetify/vite.config.mjs +++ b/packages/vuetify/vite.config.mjs @@ -20,7 +20,7 @@ const components = files.filter(file => file.startsWith('src/labs') || !block.so const map = new Map(components.flatMap(file => { const src = readFileSync(file, { encoding: 'utf8' }) const matches = src.matchAll(/export const (V\w+)|export { (V\w+) }/gm) - return Array.from(matches, m => [m[1] || m[2], file.replace('src/', '@/')]) + return Array.from(matches, m => [m[1] || m[2], file.replace('src/', '@/').replace('/index.ts', '')]) })) export default defineConfig(({ mode }) => { @@ -45,7 +45,7 @@ export default defineConfig(({ mode }) => { vueJsx({ optimize: false, enableObjectSlots: true }), viteSSR(), Components({ - dts: false, + dts: true, resolvers: [ name => { if (map.has(name)) { From 26d33bbe10766482634d29c46a86f113d968fe63 Mon Sep 17 00:00:00 2001 From: Yuchao Wu Date: Wed, 8 Mar 2023 20:34:59 +1100 Subject: [PATCH 3/8] Remove .ts suffix in import path --- packages/vuetify/dev/components.d.ts | 8 ++++---- packages/vuetify/vite.config.mjs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/vuetify/dev/components.d.ts b/packages/vuetify/dev/components.d.ts index 7942261a49b..86059fb661f 100644 --- a/packages/vuetify/dev/components.d.ts +++ b/packages/vuetify/dev/components.d.ts @@ -7,10 +7,10 @@ declare module '@vue/runtime-core' { export interface GlobalComponents { RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] - VApp: typeof import('@/components/VApp')['VApp'] - VAutocomplete: typeof import('@/components/VAutocomplete')['VAutocomplete'] - VBtn: typeof import('@/components/VBtn')['VBtn'] - VMain: typeof import('@/components/VMain')['VMain'] + VApp: typeof import('@/components/VApp/index')['VApp'] + VAutocomplete: typeof import('@/components/VAutocomplete/index')['VAutocomplete'] + VBtn: typeof import('@/components/VBtn/index')['VBtn'] + VMain: typeof import('@/components/VMain/index')['VMain'] } } diff --git a/packages/vuetify/vite.config.mjs b/packages/vuetify/vite.config.mjs index 34370850f78..67e41b81be1 100644 --- a/packages/vuetify/vite.config.mjs +++ b/packages/vuetify/vite.config.mjs @@ -20,7 +20,7 @@ const components = files.filter(file => file.startsWith('src/labs') || !block.so const map = new Map(components.flatMap(file => { const src = readFileSync(file, { encoding: 'utf8' }) const matches = src.matchAll(/export const (V\w+)|export { (V\w+) }/gm) - return Array.from(matches, m => [m[1] || m[2], file.replace('src/', '@/').replace('/index.ts', '')]) + return Array.from(matches, m => [m[1] || m[2], file.replace('src/', '@/').replace('.ts', '')]) })) export default defineConfig(({ mode }) => { From c12117110788cd8ce148ed92040167137424196e Mon Sep 17 00:00:00 2001 From: Yuchao Wu Date: Wed, 8 Mar 2023 23:58:13 +1100 Subject: [PATCH 4/8] Try to automatically get the full list of compoentns types --- packages/vuetify/dev/components.d.ts | 61 ++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/packages/vuetify/dev/components.d.ts b/packages/vuetify/dev/components.d.ts index 86059fb661f..b50a5efa730 100644 --- a/packages/vuetify/dev/components.d.ts +++ b/packages/vuetify/dev/components.d.ts @@ -7,10 +7,71 @@ declare module '@vue/runtime-core' { export interface GlobalComponents { RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] + VAlert: typeof import('@/components/VAlert/index')['VAlert'] VApp: typeof import('@/components/VApp/index')['VApp'] VAutocomplete: typeof import('@/components/VAutocomplete/index')['VAutocomplete'] + VAvatar: typeof import('@/components/VAvatar/index')['VAvatar'] + VBadge: typeof import('@/components/VBadge/index')['VBadge'] + VBanner: typeof import('@/components/VBanner/index')['VBanner'] + VBreadcrumbs: typeof import('@/components/VBreadcrumbs/index')['VBreadcrumbs'] + VBreadcrumbsItem: typeof import('@/components/VBreadcrumbs/index')['VBreadcrumbsItem'] VBtn: typeof import('@/components/VBtn/index')['VBtn'] + VBtnToggle: typeof import('@/components/VBtnToggle/index')['VBtnToggle'] + VCard: typeof import('@/components/VCard/index')['VCard'] + VCardActions: typeof import('@/components/VCard/index')['VCardActions'] + VCardSubtitle: typeof import('@/components/VCard/index')['VCardSubtitle'] + VCardText: typeof import('@/components/VCard/index')['VCardText'] + VCardTitle: typeof import('@/components/VCard/index')['VCardTitle'] + VCarousel: typeof import('@/components/VCarousel/index')['VCarousel'] + VCarouselItem: typeof import('@/components/VCarousel/index')['VCarouselItem'] + VCheckbox: typeof import('@/components/VCheckbox/index')['VCheckbox'] + VChip: typeof import('@/components/VChip/index')['VChip'] + VColorPicker: typeof import('@/components/VColorPicker/index')['VColorPicker'] + VCombobox: typeof import('@/components/VCombobox/index')['VCombobox'] + VContainer: typeof import('@/components/VGrid/index')['VContainer'] + VDataTable: typeof import('@/labs/VDataTable/index')['VDataTable'] + VDialog: typeof import('@/components/VDialog/index')['VDialog'] + VDivider: typeof import('@/components/VDivider/index')['VDivider'] + VExpansionPanel: typeof import('@/components/VExpansionPanel/index')['VExpansionPanel'] + VFooter: typeof import('@/components/VFooter/index')['VFooter'] + VForm: typeof import('@/components/VForm/index')['VForm'] + VHover: typeof import('@/components/VHover/index')['VHover'] + VIcon: typeof import('@/components/VIcon/index')['VIcon'] + VImg: typeof import('@/components/VImg/index')['VImg'] + VInput: typeof import('@/components/VInput/index')['VInput'] + VItem: typeof import('@/components/VItemGroup/index')['VItem'] + VItemGroup: typeof import('@/components/VItemGroup/index')['VItemGroup'] + VLabel: typeof import('@/components/VLabel/index')['VLabel'] + VList: typeof import('@/components/VList/index')['VList'] + VListGroup: typeof import('@/components/VList/index')['VListGroup'] + VListItem: typeof import('@/components/VList/index')['VListItem'] VMain: typeof import('@/components/VMain/index')['VMain'] + VMenu: typeof import('@/components/VMenu/index')['VMenu'] + VMessages: typeof import('@/components/VMessages/index')['VMessages'] + VNavigationDrawer: typeof import('@/components/VNavigationDrawer/index')['VNavigationDrawer'] + VOverlay: typeof import('@/components/VOverlay/index')['VOverlay'] + VPagination: typeof import('@/components/VPagination/index')['VPagination'] + VProgressCircular: typeof import('@/components/VProgressCircular/index')['VProgressCircular'] + VProgressLinear: typeof import('@/components/VProgressLinear/index')['VProgressLinear'] + VRadio: typeof import('@/components/VRadio/index')['VRadio'] + VRangeSlider: typeof import('@/components/VRangeSlider/index')['VRangeSlider'] + VRating: typeof import('@/components/VRating/index')['VRating'] + VResponsive: typeof import('@/components/VResponsive/index')['VResponsive'] + VSelect: typeof import('@/components/VSelect/index')['VSelect'] + VSheet: typeof import('@/components/VSheet/index')['VSheet'] + VSlider: typeof import('@/components/VSlider/index')['VSlider'] + VSnackbar: typeof import('@/components/VSnackbar/index')['VSnackbar'] + VSwitch: typeof import('@/components/VSwitch/index')['VSwitch'] + VSystemBar: typeof import('@/components/VSystemBar/index')['VSystemBar'] + VTab: typeof import('@/components/VTabs/index')['VTab'] + VTabs: typeof import('@/components/VTabs/index')['VTabs'] + VTextarea: typeof import('@/components/VTextarea/index')['VTextarea'] + VThemeProvider: typeof import('@/components/VThemeProvider/index')['VThemeProvider'] + VTimeline: typeof import('@/components/VTimeline/index')['VTimeline'] + VTimelineItem: typeof import('@/components/VTimeline/index')['VTimelineItem'] + VToolbar: typeof import('@/components/VToolbar/index')['VToolbar'] + VToolbarTitle: typeof import('@/components/VToolbar/index')['VToolbarTitle'] + VTooltip: typeof import('@/components/VTooltip/index')['VTooltip'] } } From f07ca606432b7ce5ebb7153f27fa25a61ed1cb40 Mon Sep 17 00:00:00 2001 From: Yuchao Wu Date: Thu, 9 Mar 2023 12:43:41 +1100 Subject: [PATCH 5/8] ignore components.d.ts --- packages/vuetify/.eslintignore | 1 + packages/vuetify/.gitignore | 1 + packages/vuetify/dev/components.d.ts | 78 ---------------------------- 3 files changed, 2 insertions(+), 78 deletions(-) delete mode 100644 packages/vuetify/dev/components.d.ts diff --git a/packages/vuetify/.eslintignore b/packages/vuetify/.eslintignore index 4f08e7f03fd..de1f0e8829e 100644 --- a/packages/vuetify/.eslintignore +++ b/packages/vuetify/.eslintignore @@ -1,4 +1,5 @@ /build/ +/dev/*.d.ts # Built files /es5/ diff --git a/packages/vuetify/.gitignore b/packages/vuetify/.gitignore index ca9f5d7d02b..1cdbaeaa2ed 100644 --- a/packages/vuetify/.gitignore +++ b/packages/vuetify/.gitignore @@ -1,4 +1,5 @@ /dev/Playground.vue +/dev/components.d.ts /cypress/screenshots # Built files diff --git a/packages/vuetify/dev/components.d.ts b/packages/vuetify/dev/components.d.ts deleted file mode 100644 index b50a5efa730..00000000000 --- a/packages/vuetify/dev/components.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -// generated by unplugin-vue-components -// We suggest you to commit this file into source control -// Read more: https://github.com/vuejs/core/pull/3399 -import '@vue/runtime-core' - -declare module '@vue/runtime-core' { - export interface GlobalComponents { - RouterLink: typeof import('vue-router')['RouterLink'] - RouterView: typeof import('vue-router')['RouterView'] - VAlert: typeof import('@/components/VAlert/index')['VAlert'] - VApp: typeof import('@/components/VApp/index')['VApp'] - VAutocomplete: typeof import('@/components/VAutocomplete/index')['VAutocomplete'] - VAvatar: typeof import('@/components/VAvatar/index')['VAvatar'] - VBadge: typeof import('@/components/VBadge/index')['VBadge'] - VBanner: typeof import('@/components/VBanner/index')['VBanner'] - VBreadcrumbs: typeof import('@/components/VBreadcrumbs/index')['VBreadcrumbs'] - VBreadcrumbsItem: typeof import('@/components/VBreadcrumbs/index')['VBreadcrumbsItem'] - VBtn: typeof import('@/components/VBtn/index')['VBtn'] - VBtnToggle: typeof import('@/components/VBtnToggle/index')['VBtnToggle'] - VCard: typeof import('@/components/VCard/index')['VCard'] - VCardActions: typeof import('@/components/VCard/index')['VCardActions'] - VCardSubtitle: typeof import('@/components/VCard/index')['VCardSubtitle'] - VCardText: typeof import('@/components/VCard/index')['VCardText'] - VCardTitle: typeof import('@/components/VCard/index')['VCardTitle'] - VCarousel: typeof import('@/components/VCarousel/index')['VCarousel'] - VCarouselItem: typeof import('@/components/VCarousel/index')['VCarouselItem'] - VCheckbox: typeof import('@/components/VCheckbox/index')['VCheckbox'] - VChip: typeof import('@/components/VChip/index')['VChip'] - VColorPicker: typeof import('@/components/VColorPicker/index')['VColorPicker'] - VCombobox: typeof import('@/components/VCombobox/index')['VCombobox'] - VContainer: typeof import('@/components/VGrid/index')['VContainer'] - VDataTable: typeof import('@/labs/VDataTable/index')['VDataTable'] - VDialog: typeof import('@/components/VDialog/index')['VDialog'] - VDivider: typeof import('@/components/VDivider/index')['VDivider'] - VExpansionPanel: typeof import('@/components/VExpansionPanel/index')['VExpansionPanel'] - VFooter: typeof import('@/components/VFooter/index')['VFooter'] - VForm: typeof import('@/components/VForm/index')['VForm'] - VHover: typeof import('@/components/VHover/index')['VHover'] - VIcon: typeof import('@/components/VIcon/index')['VIcon'] - VImg: typeof import('@/components/VImg/index')['VImg'] - VInput: typeof import('@/components/VInput/index')['VInput'] - VItem: typeof import('@/components/VItemGroup/index')['VItem'] - VItemGroup: typeof import('@/components/VItemGroup/index')['VItemGroup'] - VLabel: typeof import('@/components/VLabel/index')['VLabel'] - VList: typeof import('@/components/VList/index')['VList'] - VListGroup: typeof import('@/components/VList/index')['VListGroup'] - VListItem: typeof import('@/components/VList/index')['VListItem'] - VMain: typeof import('@/components/VMain/index')['VMain'] - VMenu: typeof import('@/components/VMenu/index')['VMenu'] - VMessages: typeof import('@/components/VMessages/index')['VMessages'] - VNavigationDrawer: typeof import('@/components/VNavigationDrawer/index')['VNavigationDrawer'] - VOverlay: typeof import('@/components/VOverlay/index')['VOverlay'] - VPagination: typeof import('@/components/VPagination/index')['VPagination'] - VProgressCircular: typeof import('@/components/VProgressCircular/index')['VProgressCircular'] - VProgressLinear: typeof import('@/components/VProgressLinear/index')['VProgressLinear'] - VRadio: typeof import('@/components/VRadio/index')['VRadio'] - VRangeSlider: typeof import('@/components/VRangeSlider/index')['VRangeSlider'] - VRating: typeof import('@/components/VRating/index')['VRating'] - VResponsive: typeof import('@/components/VResponsive/index')['VResponsive'] - VSelect: typeof import('@/components/VSelect/index')['VSelect'] - VSheet: typeof import('@/components/VSheet/index')['VSheet'] - VSlider: typeof import('@/components/VSlider/index')['VSlider'] - VSnackbar: typeof import('@/components/VSnackbar/index')['VSnackbar'] - VSwitch: typeof import('@/components/VSwitch/index')['VSwitch'] - VSystemBar: typeof import('@/components/VSystemBar/index')['VSystemBar'] - VTab: typeof import('@/components/VTabs/index')['VTab'] - VTabs: typeof import('@/components/VTabs/index')['VTabs'] - VTextarea: typeof import('@/components/VTextarea/index')['VTextarea'] - VThemeProvider: typeof import('@/components/VThemeProvider/index')['VThemeProvider'] - VTimeline: typeof import('@/components/VTimeline/index')['VTimeline'] - VTimelineItem: typeof import('@/components/VTimeline/index')['VTimelineItem'] - VToolbar: typeof import('@/components/VToolbar/index')['VToolbar'] - VToolbarTitle: typeof import('@/components/VToolbar/index')['VToolbarTitle'] - VTooltip: typeof import('@/components/VTooltip/index')['VTooltip'] - } -} - -export {} From 60374bb106f37eeed1bbf8dd4edf3bf0d0db796c Mon Sep 17 00:00:00 2001 From: Yuchao Wu Date: Thu, 9 Mar 2023 12:48:00 +1100 Subject: [PATCH 6/8] Adjust eslintignore --- .eslintignore | 1 + packages/vuetify/.eslintignore | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000000..8d86d9d3123 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +/packages/vuetify/dev/components.d.ts diff --git a/packages/vuetify/.eslintignore b/packages/vuetify/.eslintignore index de1f0e8829e..4f08e7f03fd 100644 --- a/packages/vuetify/.eslintignore +++ b/packages/vuetify/.eslintignore @@ -1,5 +1,4 @@ /build/ -/dev/*.d.ts # Built files /es5/ From 565cc698dd6ddda70b875d65a60ac479f10f66c5 Mon Sep 17 00:00:00 2001 From: Yuchao Wu Date: Thu, 9 Mar 2023 12:56:14 +1100 Subject: [PATCH 7/8] add comment --- .eslintignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintignore b/.eslintignore index 8d86d9d3123..22cd42dbdf2 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,2 @@ +# playground components type definitions generated by unplugin-vue-components /packages/vuetify/dev/components.d.ts From a83e8e5dd2d8e737f03bc519a96c69a52f7c77b1 Mon Sep 17 00:00:00 2001 From: Kael Date: Wed, 22 Mar 2023 01:55:00 +1100 Subject: [PATCH 8/8] use existing eslintignore --- .eslintignore | 2 -- packages/vuetify/.eslintignore | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) delete mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 22cd42dbdf2..00000000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -# playground components type definitions generated by unplugin-vue-components -/packages/vuetify/dev/components.d.ts diff --git a/packages/vuetify/.eslintignore b/packages/vuetify/.eslintignore index 4f08e7f03fd..e0a4dbe295d 100644 --- a/packages/vuetify/.eslintignore +++ b/packages/vuetify/.eslintignore @@ -1,8 +1,11 @@ /build/ +# playground components type definitions generated by unplugin-vue-components +/dev/components.d.ts + # Built files /es5/ /lib/ /lib-temp/ /dist/ -/cypress/ \ No newline at end of file +/cypress/