-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
107 additions
and
159 deletions.
There are no files selected for viewing
16 changes: 0 additions & 16 deletions
16
sources/@roots/bud-api/src/api/methods/alias/alias.interface.ts
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
sources/@roots/bud-api/src/api/methods/alias/alias.method.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
export type {facade} from './alias.interface' | ||
export {alias as method} from './alias.method' | ||
export {alias} from './alias.method' | ||
import type {Framework} from '@roots/bud-framework' | ||
import type {Configuration} from 'webpack' | ||
|
||
export interface facade { | ||
(alias: Configuration['resolve']['alias']): Framework | ||
} | ||
|
||
export interface alias { | ||
(alias: Configuration['resolve']['alias']): Promise<Framework> | ||
} | ||
|
||
export const alias: alias = async function (input) { | ||
const app = this as Framework | ||
|
||
input = Object.entries(input).reduce((a, [k, v]) => { | ||
if (v.startsWith('@')) { | ||
return {...a, [k]: app.path(v)} | ||
} | ||
|
||
if (!v.startsWith('/')) { | ||
return {...a, [k]: app.path(v)} | ||
} | ||
|
||
return {...a, [k]: v} | ||
}, {}) | ||
|
||
app.hooks.async('build.resolve.alias', async aliases => { | ||
return {...(aliases ?? {}), ...(input ?? {})} | ||
}) | ||
|
||
return app | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters