File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { resolveClean } from '../features/clean'
77import { resolveEntry } from '../features/entry'
88import { resolveTarget } from '../features/target'
99import { resolveTsconfig } from '../features/tsconfig'
10+ import { resolveRegex } from '../utils/general'
1011import { logger } from '../utils/logger'
1112import { normalizeFormat , readPackageJson } from '../utils/package'
1213import type { Awaitable } from '../utils/types'
@@ -201,6 +202,8 @@ async function resolveConfig(
201202 cwd = process . cwd ( ) ,
202203 name,
203204 workspace,
205+ external,
206+ noExternal,
204207 } = userConfig
205208
206209 outDir = path . resolve ( cwd , outDir )
@@ -216,6 +219,12 @@ async function resolveConfig(
216219 }
217220 target = resolveTarget ( target , pkg , name )
218221 tsconfig = await resolveTsconfig ( tsconfig , cwd , name )
222+ if ( typeof external === 'string' ) {
223+ external = resolveRegex ( external )
224+ }
225+ if ( typeof noExternal === 'string' ) {
226+ noExternal = resolveRegex ( noExternal )
227+ }
219228
220229 if ( publint === true ) publint = { }
221230
@@ -286,6 +295,8 @@ async function resolveConfig(
286295 copy : publicDir || copy ,
287296 hash : hash ?? true ,
288297 name,
298+ external,
299+ noExternal,
289300 }
290301
291302 return config
Original file line number Diff line number Diff line change @@ -16,6 +16,13 @@ export function resolveComma<T extends string>(arr: T[]): T[] {
1616 return arr . flatMap ( ( format ) => format . split ( ',' ) as T [ ] )
1717}
1818
19+ export function resolveRegex ( str : string ) : string | RegExp {
20+ if ( str . length > 2 && str [ 0 ] === '/' && str . at ( - 1 ) === '/' ) {
21+ return new RegExp ( str . slice ( 1 , - 1 ) )
22+ }
23+ return str
24+ }
25+
1926export function debounce < T extends ( ...args : any [ ] ) => any > (
2027 fn : T ,
2128 wait : number ,
You can’t perform that action at this time.
0 commit comments