From 106d786c89fde75e3b4545edc44cf83ba134b949 Mon Sep 17 00:00:00 2001 From: Kelly Mears Date: Fri, 22 Sep 2023 00:24:21 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20improve(patch):=20improve=20@roots/?= =?UTF-8?q?bud-solid=20exports=20map=20(#2457)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Type of change **PATCH: backwards compatible change** --- sources/@roots/bud-solid/package.json | 12 +----------- sources/@roots/bud-solid/src/extension.ts | 7 +++++-- sources/@roots/bud-solid/src/index.ts | 11 +++++++++-- sources/@roots/bud-solid/src/types.ts | 5 ----- sources/@roots/bud-solid/test/extension.test.ts | 3 +-- 5 files changed, 16 insertions(+), 22 deletions(-) delete mode 100644 sources/@roots/bud-solid/src/types.ts diff --git a/sources/@roots/bud-solid/package.json b/sources/@roots/bud-solid/package.json index 8f9fb0b525..2421c81936 100644 --- a/sources/@roots/bud-solid/package.json +++ b/sources/@roots/bud-solid/package.json @@ -51,22 +51,12 @@ ], "type": "module", "exports": { - ".": { - "import": "./lib/index.js", - "default": "./lib/index.js" - }, - "./types": { - "import": "./lib/types.js", - "default": "./lib/types.js" - } + ".": "./lib/index.js" }, "typesVersions": { "*": { ".": [ "./lib/index.d.ts" - ], - "types": [ - "./lib/types.d.ts" ] } }, diff --git a/sources/@roots/bud-solid/src/extension.ts b/sources/@roots/bud-solid/src/extension.ts index 97d4972333..5513b63fe9 100644 --- a/sources/@roots/bud-solid/src/extension.ts +++ b/sources/@roots/bud-solid/src/extension.ts @@ -18,9 +18,12 @@ export default class BudSolid extends Extension { */ @bind public override async boot(bud: Bud) { - bud.babel.setPreset( + const babelPresetSolid = await this.resolve( `babel-preset-solid`, - await this.resolve(`babel-preset-solid`, import.meta.url), + import.meta.url, ) + if (!babelPresetSolid) return + + bud.babel.setPreset(`babel-preset-solid`, babelPresetSolid) } } diff --git a/sources/@roots/bud-solid/src/index.ts b/sources/@roots/bud-solid/src/index.ts index e3cbf4774d..1b244f4288 100644 --- a/sources/@roots/bud-solid/src/index.ts +++ b/sources/@roots/bud-solid/src/index.ts @@ -7,6 +7,13 @@ * @see https://bud.js.org * @see https://github.com/roots/bud */ -import './types.js' -export {default} from './extension.js' +import BudSolid from './extension.js' + +declare module '@roots/bud-framework' { + interface Modules { + '@roots/bud-solid': BudSolid + } +} + +export {BudSolid as default} diff --git a/sources/@roots/bud-solid/src/types.ts b/sources/@roots/bud-solid/src/types.ts deleted file mode 100644 index d54c1121b0..0000000000 --- a/sources/@roots/bud-solid/src/types.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare module '@roots/bud-framework' { - interface Modules { - '@roots/bud-solid': {} - } -} diff --git a/sources/@roots/bud-solid/test/extension.test.ts b/sources/@roots/bud-solid/test/extension.test.ts index 981ea3ef3b..c623734e3d 100644 --- a/sources/@roots/bud-solid/test/extension.test.ts +++ b/sources/@roots/bud-solid/test/extension.test.ts @@ -1,7 +1,6 @@ +import Extension from '@roots/bud-solid' import {describe, expect, it} from 'vitest' -import Extension from '../src/index.js' - describe(`@roots/bud-solid`, () => { it(`should be constructable`, () => { expect(Extension).toBeInstanceOf(Function)