From 79fbed30ce7b4d5b4aaa6871d53d6dcbc539fc98 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sun, 21 May 2023 14:24:15 +0200 Subject: [PATCH 1/3] chore: update snapshot --- test/__snapshots__/dts.test.ts.snap | 1 + 1 file changed, 1 insertion(+) diff --git a/test/__snapshots__/dts.test.ts.snap b/test/__snapshots__/dts.test.ts.snap index 7e80f46b..cc8578df 100644 --- a/test/__snapshots__/dts.test.ts.snap +++ b/test/__snapshots__/dts.test.ts.snap @@ -114,6 +114,7 @@ declare global { const toRaw: typeof import('vue-demi')['toRaw'] const toRef: typeof import('vue-demi')['toRef'] const toRefs: typeof import('vue-demi')['toRefs'] + const toValue: typeof import('vue-demi')['toValue'] const triggerRef: typeof import('vue-demi')['triggerRef'] const tweened: typeof import('svelte/motion')['tweened'] const unref: typeof import('vue-demi')['unref'] From f5c55950f030ae6fa0c586c7a49aecf9948d1115 Mon Sep 17 00:00:00 2001 From: lishaobos <46661044+lishaobos@users.noreply.github.com> Date: Mon, 22 May 2023 23:10:16 +0800 Subject: [PATCH 2/3] fix: dts reg error (#381) --- src/core/ctx.ts | 8 ++++---- test/dts.increase.test.ts | 1 + test/tmp/dts.increase.d.ts | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/ctx.ts b/src/core/ctx.ts index adc20d4f..eb3faa46 100644 --- a/src/core/ctx.ts +++ b/src/core/ctx.ts @@ -112,7 +112,7 @@ ${dts}`.trim()}\n` originalDTS[key] = currentDTS[key] }) const dtsList = Object.keys(originalDTS).sort().map(k => ` ${k}: ${originalDTS[k]}`) - return currentContent.replace(dtsReg, `declare global {\n${dtsList.join('\n')}\n}`) + return currentContent.replace(dtsReg, () => `declare global {\n${dtsList.join('\n')}\n}`) } return currentContent @@ -166,13 +166,13 @@ ${dts}`.trim()}\n` async function scanDirs() { if (dirs?.length) { await unimport.modifyDynamicImports(async (imports) => { - const exports = await scanDirExports(dirs, { + const exports_ = await scanDirExports(dirs, { filePatterns: ['*.{tsx,jsx,ts,js,mjs,cjs,mts,cts}'], }) as ImportExtended[] - exports.forEach(i => i.__source = 'dir') + exports_.forEach(i => i.__source = 'dir') return modifyDefaultExportsAlias([ ...imports.filter((i: ImportExtended) => i.__source !== 'dir'), - ...exports, + ...exports_, ], options) }) } diff --git a/test/dts.increase.test.ts b/test/dts.increase.test.ts index b45dbb9c..e2cc1513 100644 --- a/test/dts.increase.test.ts +++ b/test/dts.increase.test.ts @@ -14,4 +14,5 @@ it('dts', async () => { const dtsContent = await ctx.generateDTS(dts) expect(dtsContent).toContain('AAA') expect(dtsContent).toContain('BBB') + expect(dtsContent).toContain('$$') }) diff --git a/test/tmp/dts.increase.d.ts b/test/tmp/dts.increase.d.ts index 9c2592ef..043f35cd 100644 --- a/test/tmp/dts.increase.d.ts +++ b/test/tmp/dts.increase.d.ts @@ -4,6 +4,8 @@ // Generated by unplugin-auto-import export {} declare global { + const $$: typeof import('vue/macros')['$$'] + const $: typeof import('vue/macros')['$'] const AAA: typeof import('xxx/es')['AAA'] const BBB: typeof import('xxx/es')['BBB'] } From fd69c8af121520710be9238837cfc21e3b5b3576 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Mon, 22 May 2023 17:10:35 +0200 Subject: [PATCH 3/3] chore: release v0.16.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2abe9ece..5aa86f74 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "unplugin-auto-import", "type": "module", - "version": "0.16.1", + "version": "0.16.2", "packageManager": "pnpm@8.5.1", "description": "Register global imports on demand for Vite and Webpack", "author": "Anthony Fu ",