import { isRelativePath } from '@astrojs/internal-helpers/path'; import type { Config, ConfigType as MarkdocConfig, MaybePromise, NodeType, Schema, } from '@markdoc/markdoc'; import _Markdoc from '@markdoc/markdoc'; import type { AstroInstance } from 'astro'; import { heading } from './heading-ids.js'; import { componentConfigSymbol } from './utils.js'; export type Render = ComponentConfig | AstroInstance['default'] | string; export type ComponentConfig = { type: 'package' | 'local'; path: string; namedExport?: string; [componentConfigSymbol]: true; }; export type AstroMarkdocConfig = Record> = Omit< MarkdocConfig, 'tags' | 'nodes' > & Partial<{ tags: Record>; nodes: Partial>>; ctx: C; extends: MaybePromise[]; }>; export type ResolvedAstroMarkdocConfig = Omit; export const Markdoc = _Markdoc; export const nodes = { ...Markdoc.nodes, heading }; export function defineMarkdocConfig(config: AstroMarkdocConfig): AstroMarkdocConfig { return config; } export function component(pathnameOrPkgName: string, namedExport?: string): ComponentConfig { return { type: isNpmPackageName(pathnameOrPkgName) ? 'package' : 'local', path: pathnameOrPkgName, namedExport, [componentConfigSymbol]: true, }; } function isNpmPackageName(pathname: string) { return !isRelativePath(pathname) && !pathname.startsWith('/'); } ommand'>ciro/fix-test-command Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-06-04take twoGravatar Jarred Sumner 6-137/+401
2022-06-03impl #1Gravatar Jarred Sumner 4-0/+403
2022-06-03tempGravatar Jarred Sumner 2-16/+5
2022-06-03Move streams to it's own fileGravatar Jarred Sumner 7-1155/+1504
2022-06-03Update streams.test.jsGravatar Jarred Sumner 1-7/+49
2022-06-02Handle empty files/blobsGravatar Jarred Sumner 11-396/+54
2022-06-02Fix off by one & exceptionsGravatar Jarred Sumner 1-3/+6
2022-06-02Faster ReadableStreamGravatar Jarred Sumner 26-645/+716