/
utils.ts
39 lines (30 loc) · 947 Bytes
/
utils.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import type { webpack } from 'next/dist/compiled/webpack/webpack'
import type { NextConfigComplete } from '../../../server/config-shared'
export type ConfigurationContext = {
hasAppDir: boolean
supportedBrowsers: string[] | undefined
rootDirectory: string
customAppFile: RegExp | undefined
isDevelopment: boolean
isProduction: boolean
isServer: boolean
isClient: boolean
isEdgeRuntime: boolean
targetWeb: boolean
assetPrefix: string
sassOptions: any
productionBrowserSourceMaps: boolean
transpilePackages: NextConfigComplete['transpilePackages']
future: NextConfigComplete['future']
experimental: NextConfigComplete['experimental']
}
export type ConfigurationFn = (
a: webpack.Configuration
) => webpack.Configuration
export const pipe =
<R>(...fns: Array<(a: R) => R | Promise<R>>) =>
(param: R) =>
fns.reduce(
async (result: R | Promise<R>, next) => next(await result),
param
)