Skip to content

Commit

Permalink
refactor: Make exports explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Aug 6, 2024
1 parent 5f9b028 commit ca00ea5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 24 deletions.
10 changes: 7 additions & 3 deletions src/index-browser.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
export type { Cheerio } from './cheerio.js';
export type * from './types.js';
export type { CheerioOptions, HTMLParser2Options } from './options.js';
export type { CheerioAPI } from './load.js';
export type {
Cheerio,
CheerioAPI,
CheerioOptions,
HTMLParser2Options,
} from './slim.js';
export { contains, merge } from './static.js';

export * from './load-parse.js';
13 changes: 7 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
*/

export * from './load-parse.js';

export type { Cheerio } from './cheerio.js';
export { contains, merge } from './static.js';
export type * from './types.js';
export type { CheerioOptions, HTMLParser2Options } from './options.js';
export type { CheerioAPI } from './load.js';

/* eslint-disable n/no-unsupported-features/node-builtins */
export type {
Cheerio,
CheerioAPI,
CheerioOptions,
HTMLParser2Options,
} from './slim.js';

import { adapter as htmlparser2Adapter } from 'parse5-htmlparser2-tree-adapter';
import * as htmlparser2 from 'htmlparser2';
Expand Down
2 changes: 0 additions & 2 deletions src/load-parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import renderWithHtmlparser2 from 'dom-serializer';
import { parseDocument as parseWithHtmlparser2 } from 'htmlparser2';
import type { AnyNode } from 'domhandler';

export { contains, merge } from './static.js';

const parse = getParse((content, options, isDocument, context) =>
options._useHtmlParser2
? parseWithHtmlparser2(content, options)
Expand Down
18 changes: 5 additions & 13 deletions src/slim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,11 @@ import type { AnyNode } from 'domhandler';
import render from 'dom-serializer';
import { parseDocument } from 'htmlparser2';

export type {
Cheerio,
CheerioAPI,
CheerioOptions,
HTMLParser2Options,
} from './index.js';

/**
* Types used in signatures of Cheerio methods.
*
* @category Cheerio
*/
export * from './types.js';
export { contains, merge } from './static.js';
export type * from './types.js';
export type { Cheerio } from './cheerio.js';
export type { CheerioOptions, HTMLParser2Options } from './options.js';
export type { CheerioAPI } from './load.js';

/**
* Create a querying function, bound to a document created from the provided
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/** @file Types used in signatures of Cheerio methods. */

type LowercaseLetters =
| 'a'
| 'b'
Expand Down

0 comments on commit ca00ea5

Please sign in to comment.