UNPKG

1.1 kBJavaScriptView Raw
1import * as builtinHandlers from './handlers/index.js';
2import parse from './parse.js';
3import * as builtinResolvers from './resolver/index.js';
4import { fsImporter, ignoreImporter, makeFsImporter, } from './importer/index.js';
5import * as utils from './utils/index.js';
6import { createConfig, defaultHandlers } from './config.js';
7import { ERROR_CODES } from './error.js';
8const builtinImporters = {
9 fsImporter,
10 ignoreImporter,
11};
12/**
13 * Parse the *src* and scan for react components based on the config
14 * that gets supplied.
15 *
16 * The default resolvers look for *exported* react components.
17 *
18 * By default all handlers are applied, so that all possible
19 * different use cases are covered.
20 *
21 * The default importer is the fs-importer that tries to resolve
22 * files based on the nodejs resolve algorithm.
23 */
24function defaultParse(src, config = {}) {
25 const defaultConfig = createConfig(config);
26 return parse(String(src), defaultConfig);
27}
28export { builtinHandlers, builtinResolvers, builtinImporters, defaultHandlers, makeFsImporter, defaultParse as parse, utils, ERROR_CODES, };