Skip to content

Commit ab46f33

Browse files
phateddanez
authored andcommitted
Switch default importer to ignoreImports, fix type sigs w/ babel options, update tests
1 parent dac385d commit ab46f33

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/__tests__/main-test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import fs from 'fs';
1010
import path from 'path';
11-
import { handlers, parse } from '../main';
11+
import { handlers, parse, importers } from '../main';
1212
import { ERROR_MISSING_DEFINITION } from '../parse';
1313

1414
describe('main', () => {
@@ -216,6 +216,7 @@ describe('main', () => {
216216
});
217217
});
218218

219+
// Fixures uses the resolveImports importer even though it is not the default
219220
describe('fixtures', () => {
220221
const fixturePath = path.join(__dirname, 'fixtures');
221222
const fileNames = fs.readdirSync(fixturePath);
@@ -227,6 +228,7 @@ describe('main', () => {
227228
let result;
228229
expect(() => {
229230
result = parse(fileContent, null, null, {
231+
importer: importers.resolveImports,
230232
filename: filePath,
231233
babelrc: false,
232234
});

src/babelParser.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ type BabelOptions = {
6666
babelrcRoots?: true | string | string[],
6767
};
6868

69-
export type Options = BabelOptions & {
70-
parserOptions?: ParserOptions,
69+
export type Options = {
70+
...$Exact<BabelOptions>,
71+
...{| parserOptions?: ParserOptions |},
7172
};
7273

7374
function buildOptions(

src/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const defaultHandlers = [
3030
allHandlers.componentMethodsHandler,
3131
allHandlers.componentMethodsJsDocHandler,
3232
];
33-
const defaultImporter = AllImporter.resolveImports;
33+
const defaultImporter = AllImporter.ignoreImports;
3434

3535
/**
3636
* See `lib/parse.js` for more information about the arguments. This function
@@ -58,9 +58,9 @@ function defaultParse(
5858
handlers = defaultHandlers;
5959
}
6060

61-
const { importer = defaultImporter } = options;
61+
const { importer = defaultImporter, ...opts } = options;
6262

63-
return parse(String(src), resolver, handlers, importer, options);
63+
return parse(String(src), resolver, handlers, importer, opts);
6464
}
6565

6666
export {

0 commit comments

Comments
 (0)