Skip to content

Commit

Permalink
fix(yaml): avoid leaking js-yaml types
Browse files Browse the repository at this point in the history
  • Loading branch information
djMax committed Oct 17, 2023
1 parent daada31 commit bc46944
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/shortstop/fileHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function yamlHandler(basedir?: string, options: yaml.LoadOptions = {}) {
const filename = resolver(value);

const content = await fs.readFile(filename, 'utf8');
return yaml.load(content, { ...options, filename });
return yaml.load(content, { ...options, filename }) as ReturnType<typeof JSON.parse>;
};
}

Expand All @@ -103,7 +103,7 @@ export function execHandler(basedir?: string) {
}

export function globHandler(optionsOrCwd?: GlobOptions | string) {
const options = typeof optionsOrCwd === 'string' ? { cwd: optionsOrCwd } : (optionsOrCwd || {});
const options = typeof optionsOrCwd === 'string' ? { cwd: optionsOrCwd } : optionsOrCwd || {};
options.cwd = options.cwd || Path.dirname(caller());

const resolvePath = pathHandler(options.cwd.toString());
Expand Down

0 comments on commit bc46944

Please sign in to comment.