11// @ts -check
2- const { resolve } = require ( 'node:path' )
2+ let { resolve } = require ( 'node:path' )
33
4- const config = require ( 'lilconfig' )
4+ let { lilconfig } = require ( 'lilconfig' )
55
6- const loadOptions = require ( './options.js' )
7- const loadPlugins = require ( './plugins.js' )
8- const req = require ( './req.js' )
6+ let loadOptions = require ( './options.js' )
7+ let loadPlugins = require ( './plugins.js' )
8+ let req = require ( './req.js' )
99
10- const interopRequireDefault = obj =>
10+ let interopRequireDefault = obj =>
1111 obj && obj . __esModule ? obj : { default : obj }
1212
1313/**
@@ -28,9 +28,7 @@ async function processResult(ctx, result) {
2828 projectConfig = { ...projectConfig , ...ctx }
2929 }
3030
31- if ( ! projectConfig . plugins ) {
32- projectConfig . plugins = [ ]
33- }
31+ if ( ! projectConfig . plugins ) projectConfig . plugins = [ ]
3432
3533 let res = {
3634 file,
@@ -61,9 +59,7 @@ function createContext(ctx) {
6159 ...ctx
6260 }
6361
64- if ( ! ctx . env ) {
65- process . env . NODE_ENV = 'development'
66- }
62+ if ( ! ctx . env ) process . env . NODE_ENV = 'development'
6763
6864 return ctx
6965}
@@ -89,7 +85,7 @@ async function yamlLoader(_, content) {
8985}
9086
9187/** @return {import('lilconfig').Options } */
92- const withLoaders = ( options = { } ) => {
88+ let withLoaders = ( options = { } ) => {
9389 let moduleName = 'postcss'
9490
9591 return {
@@ -150,13 +146,10 @@ function rc(ctx, path, options) {
150146 */
151147 path = path ? resolve ( path ) : process . cwd ( )
152148
153- return config
154- . lilconfig ( 'postcss' , withLoaders ( options ) )
149+ return lilconfig ( 'postcss' , withLoaders ( options ) )
155150 . search ( path )
156151 . then ( result => {
157- if ( ! result ) {
158- throw new Error ( `No PostCSS Config found in: ${ path } ` )
159- }
152+ if ( ! result ) throw new Error ( `No PostCSS Config found in: ${ path } ` )
160153 return processResult ( ctx , result )
161154 } )
162155}
0 commit comments