Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 470
chore(vue,types): Add initial support for SFC files to improve runtime prop checking#4902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
ddf330e17168f7d612ec5fa6e4a4efda20fdca87dc6ad2975615b7311f7ad16f9a83c36d26ab1772b8dbbc18a7ac2f62ef8ed8b4b95feecb3fb2d9d03ab2e3File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| '@clerk/types': patch | ||
| '@clerk/vue': patch | ||
| --- | ||
| Improve runtime prop checking for single-file components |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -41,10 +41,11 @@ | ||
| "dist" | ||
| ], | ||
| "scripts": { | ||
| "build": "tsup", | ||
| "build": "tsup --onSuccess \"pnpm build:dts\"", | ||
| "build:dts": "vue-tsc --declaration --emitDeclarationOnly -p tsconfig.build.json", | ||
| "dev": "tsup --watch", | ||
| "lint": "eslint src/", | ||
| "lint:attw": "attw --pack . --ignore-rules no-resolution cjs-resolves-to-esm", | ||
| "lint:attw": "attw --pack . --ignore-rules no-resolution cjs-resolves-to-esm internal-resolution-error", | ||
| "lint:publint": "publint", | ||
| "publish:local": "pnpm yalc push --replace --sig", | ||
| "test": "vitest", | ||
| @@ -56,8 +57,11 @@ | ||
| }, | ||
| "devDependencies": { | ||
| "@testing-library/vue": "^8.1.0", | ||
| "@vitejs/plugin-vue": "^5.2.1", | ||
| "@vue.ts/tsx-auto-props": "^0.6.0", | ||
| "vue": "3.5.12" | ||
| "unplugin-vue": "^5.2.1", | ||
| "vue": "3.5.12", | ||
| "vue-tsc": "^2.0.24" | ||
Comment on lines
+62
to
+64
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
| ||
| }, | ||
| "peerDependencies": { | ||
| "vue": "^3.2.0" | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| <script setup lang="ts"> | ||
| import { useAttrs, useSlots } from 'vue'; | ||
| import type { SignInProps } from '@clerk/types'; | ||
| import { useClerk } from '../composables/useClerk'; | ||
| import { assertSingleChild, normalizeWithDefaultValue } from '../utils'; | ||
| type SignInButtonProps = Pick< | ||
| SignInProps, | ||
| 'fallbackRedirectUrl' | 'forceRedirectUrl' | 'signUpForceRedirectUrl' | 'signUpFallbackRedirectUrl' | 'initialValues' | ||
| > & { | ||
| mode?: 'modal' | 'redirect'; | ||
| }; | ||
| const props = defineProps<SignInButtonProps>(); | ||
| const clerk = useClerk(); | ||
| const slots = useSlots(); | ||
| const attrs = useAttrs(); | ||
| function getChildComponent() { | ||
| const children = normalizeWithDefaultValue(slots.default?.({}), 'Sign in'); | ||
| return assertSingleChild(children, 'SignInButton'); | ||
| } | ||
| function clickHandler() { | ||
| const { mode, ...opts } = props; | ||
| if (mode === 'modal') { | ||
| return clerk.value?.openSignIn(opts); | ||
| } | ||
| void clerk.value?.redirectToSignIn({ | ||
| ...opts, | ||
| signInFallbackRedirectUrl: props.fallbackRedirectUrl, | ||
| signInForceRedirectUrl: props.forceRedirectUrl, | ||
| }); | ||
| } | ||
| </script> | ||
| <template> | ||
| <component | ||
| :is="getChildComponent" | ||
| v-bind="attrs" | ||
| @click="clickHandler" | ||
| > | ||
| <slot /> | ||
| </component> | ||
| </template> |
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <script setup lang="ts"> | ||
| import { Portal } from '../uiComponents'; | ||
| import { useClerk } from '../../composables'; | ||
| import type { SignInProps } from '@clerk/types'; | ||
| const clerk = useClerk(); | ||
| const props = defineProps<SignInProps>(); | ||
| </script> | ||
| <template> | ||
| <Portal | ||
| :mount="clerk?.mountSignIn" | ||
| :unmount="clerk?.unmountSignIn" | ||
| :props="props" | ||
| :update-props="(clerk as any)?.__unstable__updateProps" | ||
| /> | ||
| </template> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| declare module '*.vue' { | ||
| import type { DefineComponent } from 'vue'; | ||
| const component: DefineComponent<Record<string, unknown>, Record<string, unknown>, any>; | ||
| export default component; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "extends": "./tsconfig.json", | ||
| "compilerOptions": { | ||
| "declaration": true, | ||
| "declarationDir": "./dist" | ||
| }, | ||
| "include": ["src/**/*.ts", "src/**/*.vue"], | ||
| "exclude": ["src/**/*.test.ts"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import autoPropsPlugin from '@vue.ts/tsx-auto-props/esbuild'; | ||
| import { defineConfig, type Options } from 'tsup'; | ||
| import vuePlugin from 'unplugin-vue/esbuild'; | ||
| import { name, version } from './package.json'; | ||
| @@ -13,8 +14,10 @@ export default defineConfig(() => { | ||
| bundle: true, | ||
| sourcemap: true, | ||
| minify: false, | ||
| dts: true, | ||
| dts: false, | ||
| esbuildPlugins: [ | ||
| // Adds .vue files support | ||
| vuePlugin() as EsbuildPlugin, | ||
Comment on lines
+17
to
+20
| ||
| // Automatically generates runtime props from TypeScript types/interfaces for all | ||
| // control and UI components, adding them to Vue components during build via | ||
| // Object.defineProperty | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| import vue from '@vitejs/plugin-vue'; | ||
| import { defineConfig } from 'vitest/config'; | ||
| export default defineConfig({ | ||
| test: { | ||
| globals: true, | ||
| environment: 'jsdom', | ||
| }, | ||
| plugins: [vue()], | ||
| ||
| }); | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting a transitive type dependency error because the
SignInPropsis exported but not theTransferableOptioninterface that it depends on