Skip to content

Commit

Permalink
Fix resolving against the working directory in legacy API (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme authored Apr 6, 2023
1 parent 8612f48 commit c537b03
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/src/legacy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ function adjustOptions<sync extends 'sync' | 'async'>(
throw new Error('Either options.data or options.file must be set.');
}

// In legacy API, the current working directory is always attempted before
// any load path.
options.includePaths = [process.cwd(), ...(options.includePaths ?? [])];

if (
!isStringOptions(options) &&
// The `indentedSyntax` option takes precedence over the file extension in the
Expand Down Expand Up @@ -200,9 +204,7 @@ function pluginThis(
context: undefined as unknown as LegacyPluginThis,
file: options.file,
data: options.data,
includePaths: [process.cwd(), ...(options.includePaths ?? [])].join(
p.delimiter
),
includePaths: (options.includePaths ?? []).join(p.delimiter),
precision: 10,
style: 1,
indentType: 0,
Expand Down

0 comments on commit c537b03

Please sign in to comment.