File tree Expand file tree Collapse file tree 6 files changed +25
-15
lines changed Expand file tree Collapse file tree 6 files changed +25
-15
lines changed Original file line number Diff line number Diff line change 5
5
"repository" : " reactjs/react-docgen" ,
6
6
"type" : " module" ,
7
7
"browser" : {
8
- "./dist/importer/fsImporter.js" : " ./dist/importer/ignoreImports .js" ,
9
- "./src/importer/fsImporter.ts" : " ./src/importer/ignoreImports .ts"
8
+ "./dist/importer/fsImporter.js" : " ./dist/importer/ignoreImporter .js" ,
9
+ "./src/importer/fsImporter.ts" : " ./src/importer/ignoreImporter .ts"
10
10
},
11
11
"files" : [
12
12
" dist"
Original file line number Diff line number Diff line change 1
- import { handlers , parse } from '../main.js' ;
1
+ import { builtinHandlers , parse } from '../main.js' ;
2
2
import { ERROR_MISSING_DEFINITION } from '../parse.js' ;
3
3
import { describe , expect , test } from 'vitest' ;
4
4
@@ -13,7 +13,7 @@ describe('main', () => {
13
13
14
14
test ( 'parses with custom handlers' , ( ) => {
15
15
const docs = parse ( source , {
16
- handlers : [ handlers . componentDocblockHandler ] ,
16
+ handlers : [ builtinHandlers . componentDocblockHandler ] ,
17
17
} ) ;
18
18
19
19
expect ( docs ) . toMatchSnapshot ( ) ;
File renamed without changes.
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import type {
5
5
ImportDeclaration ,
6
6
} from '@babel/types' ;
7
7
import type FileState from '../FileState.js' ;
8
- import ignoreImports from './ignoreImports .js' ;
8
+ import ignoreImporter from './ignoreImporter .js' ;
9
9
import fsImporter from './fsImporter.js' ;
10
10
import makeFsImporter from './makeFsImporter.js' ;
11
11
@@ -19,4 +19,4 @@ export type Importer = (
19
19
file : FileState ,
20
20
) => NodePath | null ;
21
21
22
- export { fsImporter , ignoreImports , makeFsImporter } ;
22
+ export { fsImporter , ignoreImporter , makeFsImporter } ;
Original file line number Diff line number Diff line change 1
- import * as allHandlers from './handlers/index.js' ;
1
+ import * as builtinHandlers from './handlers/index.js' ;
2
2
import parse from './parse.js' ;
3
- import * as allResolvers from './resolver/index.js' ;
4
- import * as allImporters from './importer/index.js' ;
3
+ import * as builtinResolvers from './resolver/index.js' ;
4
+ import {
5
+ fsImporter ,
6
+ ignoreImporter ,
7
+ makeFsImporter ,
8
+ } from './importer/index.js' ;
5
9
import * as utils from './utils/index.js' ;
6
10
import type { DocumentationObject as Documentation } from './Documentation.js' ;
7
11
import type { Resolver } from './resolver/index.js' ;
@@ -11,6 +15,11 @@ import type FileState from './FileState.js';
11
15
import type { Config } from './config.js' ;
12
16
import { createConfig , defaultHandlers } from './config.js' ;
13
17
18
+ const builtinImporters = {
19
+ fsImporter,
20
+ ignoreImporter,
21
+ } ;
22
+
14
23
declare module '@babel/traverse' {
15
24
export interface HubInterface {
16
25
file : FileState ;
@@ -47,11 +56,12 @@ function defaultParse(
47
56
}
48
57
49
58
export {
50
- defaultParse as parse ,
59
+ builtinHandlers ,
60
+ builtinResolvers ,
61
+ builtinImporters ,
51
62
defaultHandlers ,
52
- allHandlers as handlers ,
53
- allResolvers as resolver ,
54
- allImporters as importers ,
63
+ makeFsImporter ,
64
+ defaultParse as parse ,
55
65
utils ,
56
66
} ;
57
67
Original file line number Diff line number Diff line change 1
1
import fs from 'fs' ;
2
2
import { dirname , join } from 'path' ;
3
3
import { describe , expect , test } from 'vitest' ;
4
- import { parse , importers } from '../../src/main' ;
4
+ import { parse , makeFsImporter } from '../../src/main' ;
5
5
import { fileURLToPath } from 'url' ;
6
6
7
7
describe ( 'integration' , ( ) => {
@@ -26,7 +26,7 @@ describe('integration', () => {
26
26
27
27
expect ( ( ) => {
28
28
result = parse ( fileContent , {
29
- importer : importers . makeFsImporter ( ) ,
29
+ importer : makeFsImporter ( ) ,
30
30
babelOptions : {
31
31
filename : filePath ,
32
32
babelrc : false ,
You can’t perform that action at this time.
0 commit comments