Skip to content

Commit

Permalink
feat(core/load): passes public functions if kpo scripts file exports …
Browse files Browse the repository at this point in the history
…a function
  • Loading branch information
rafamel committed May 3, 2019
1 parent 0a420d4 commit 04a93b8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { IOfType, IPackageOptions, TCoreOptions } from '~/types';
import options from './options';
import { absolute } from '~/utils/file';
import { diff } from 'semver';
import * as _public from '../public';

export default async function load(
paths: IPaths,
Expand Down Expand Up @@ -116,5 +117,6 @@ export async function requireLocal(
Object.assign(local.errors, errors);
}

return errors.open.throws(() => require(file));
const scripts = errors.open.throws(() => require(file));
return typeof scripts === 'function' ? scripts(_public) : scripts;
}

0 comments on commit 04a93b8

Please sign in to comment.