adonisjs / ally

AdonisJS Social Authentication Provider
MIT License
158 stars 54 forks source link

Add drivers export path #148

Closed RomainLanz closed 8 months ago

RomainLanz commented 8 months ago

Hey there! 👋🏻

This PR adds a drivers export path allowing to directly import drivers.

import { SpotifyDriver } from '@adonisjs/ally/drivers/spotify'

// Instead of
import { SpotifyDriver } from '@adonisjs/ally/build/src/drivers/spotify.js';

The PR also adds a new entry in tsup configuration to not bundle drivers.

thetutlage commented 8 months ago

Is their any reason to not bundle drivers? Also, they won't be in the compiled output at all.

RomainLanz commented 8 months ago

Is their any reason to not bundle drivers? Also, they won't be in the compiled output at all.

I am not sure about that, but doesn't the bundled driver disallow to have the import path? Because after building the code, the driver's code no longer resides in build/src/drivers but in some chunk-XXX files (examples of imports shared above are from an old version that was not using tsup).

Julien-R44 commented 8 months ago

Actually, no, adding an new entry in the tsup config will bundle the drivers, but separately. So index.ts will have its own bundle, and drivers/* will have their own bundle too. so it's ok, PR looks good to me

thetutlage commented 8 months ago

I misunderstood the world bundle here. I thought you are saying that not to compile drivers.