re-exports #
A declaration is documented once, in the module that declares it, and re-exports point to it.
An imported binding exported again
(import {a} from './x'; export {a}, or export default of an import) counts as the export … from it stands for.
Encodings #
- Same name (
export {a} from './x'): the declaration'salsoExportedFromlists the re-exporting modules, and each of those lists the edge inModuleJson.reExports({name, module, typeOnly, sourceLine}), withmodulenaming the declaring module through any chain. - Renamed (
export {a as b} from './x'): a full declarationbin the re-exporting module, withaliasOf: {module, name: "a"}and the local specifier'ssourceLine. - Star (
export * from './x'):x's path instarExports, with no per-name entries. Ifxisn't documented itself, its names document in the re-exporting module instead. - Namespace (
export * as ns from './x'): akind: 'namespace'declaration whosemodulenamesx; read its members from that module. - Packages (
export {a} from 'pkg',export * from 'pkg'):externalReExportsandexternalStarExports, with the specifier as written.
A re-export of a symbol from a module that isn't documented (like an internal/ one) is a full declaration with aliasOf, even under the same name, since there's
no declaration to link to; its aliasOf.module names a module the output lacks. A
re-export statement with its own JSDoc also gets a declaration of its own, its docs over the
original's, and @nodocs on one drops it entirely.
A Svelte component svelte2tsx failed to transform re-exports as a partial component.
Default exports #
export default and export {a as default} carry name: "default", except Svelte components, which take
their filename's name. A rename out of the default slot
(export {default as A} from './x') carries name: "A" and aliasOf: {module, name: "default"}, or the component's
name for a Svelte component.
A module's full export surface #
resolveExportSurface combines a module's declarations, re-exports,
and stars with ES semantics: explicit exports shadow star names, names ambiguous between stars
drop, and default never projects. It reports stars it can't see into rather than
guessing.
import {resolveExportSurface} from 'svelte-docinfo/postprocess.js';
const surface = resolveExportSurface(modules, 'index.ts'); The output format examples include a barrel with a rename and a star.