From 92de065b666dbf57e0324d6ddb9b383cce1c1163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Thu, 14 Nov 2024 06:10:05 +0100 Subject: [PATCH] feat(vue): add auto-import directives (#534) --- README.md | 4 ++ package.json | 2 +- playground/HelloWorld.vue | 2 +- playground/directives/custom-directive.ts | 20 ++++++++++ playground/vite.config.ts | 6 +++ pnpm-lock.yaml | 47 +++++++++++++++-------- src/core/ctx.ts | 25 ++++++------ src/core/resolvers.ts | 1 + src/types.ts | 14 ++++++- test/__snapshots__/dts.test.ts.snap | 2 +- 10 files changed, 93 insertions(+), 30 deletions(-) create mode 100644 playground/directives/custom-directive.ts diff --git a/README.md b/README.md index 85e1de52..33c5c53e 100644 --- a/README.md +++ b/README.md @@ -299,6 +299,10 @@ AutoImport({ // see https://github.com/unjs/unimport/pull/15 and https://github.com/unjs/unimport/pull/72 vueTemplate: false, + // Auto import directives inside Vue template + // see https://github.com/unjs/unimport/pull/374 + vueDirectives: undefined, + // Custom resolvers, compatible with `unplugin-vue-components` // see https://github.com/antfu/unplugin-auto-import/pull/23/ resolvers: [ diff --git a/package.json b/package.json index 851cc7a1..341c56ea 100644 --- a/package.json +++ b/package.json @@ -169,7 +169,7 @@ "local-pkg": "^0.5.0", "magic-string": "^0.30.11", "minimatch": "^9.0.5", - "unimport": "^3.12.0", + "unimport": "^3.13.1", "unplugin": "^1.14.1" }, "devDependencies": { diff --git a/playground/HelloWorld.vue b/playground/HelloWorld.vue index 92762e0c..749a9cb6 100644 --- a/playground/HelloWorld.vue +++ b/playground/HelloWorld.vue @@ -23,6 +23,6 @@ watch(count, value => emit('update', value)) Inc
{{ doubled / 2 }} x 2 = {{ doubled }}
-