Compare commits

...

2 commits

Author SHA1 Message Date
bholmesdev
41bfede8f2 fix: allow promises for extends 2023-06-05 16:30:59 -04:00
bholmesdev
5160886227 fix: types for named exports 2023-06-05 16:28:44 -04:00
3 changed files with 29 additions and 4 deletions

View file

@ -19,12 +19,21 @@
"bugs": "https://github.com/withastro/astro/issues",
"homepage": "https://docs.astro.build/en/guides/integrations-guide/markdoc/",
"exports": {
"./prism": "./dist/extensions/prism.js",
"./shiki": "./dist/extensions/shiki.js",
".": "./dist/index.js",
"./config": {
"types": "./dist/config.d.ts",
"default": "./dist/config.js"
},
"./prism": {
"types": "./dist/extensions/prism.d.ts",
"default": "./dist/extensions/prism.js"
},
"./shiki": {
"types": "./dist/extensions/shiki.d.ts",
"default": "./dist/extensions/shiki.js"
},
"./components": "./components/index.ts",
"./runtime": "./dist/runtime.js",
"./config": "./dist/config.js",
"./experimental-assets-config": "./dist/experimental-assets-config.js",
"./package.json": "./package.json"
},
@ -33,6 +42,19 @@
"dist",
"template"
],
"typesVersions": {
"*": {
"config": [
"./dist/config.d.ts"
],
"prism": [
"./dist/extensions/prism.d.ts"
],
"shiki": [
"./dist/extensions/shiki.d.ts"
]
}
},
"scripts": {
"build": "astro-scripts build \"src/**/*.ts\" && tsc",
"build:ci": "astro-scripts build \"src/**/*.ts\"",

View file

@ -1,11 +1,12 @@
import type { ConfigType as MarkdocConfig } from '@markdoc/markdoc';
import _Markdoc from '@markdoc/markdoc';
import { heading } from './heading-ids.js';
import type { MaybePromise } from './utils.js';
export type AstroMarkdocConfig<C extends Record<string, any> = Record<string, any>> =
MarkdocConfig & {
ctx?: C;
extends?: ResolvedAstroMarkdocConfig[];
extends?: MaybePromise<ResolvedAstroMarkdocConfig>[];
};
export type ResolvedAstroMarkdocConfig = Omit<AstroMarkdocConfig, 'extends'>;

View file

@ -3,6 +3,8 @@ import crypto from 'node:crypto';
import path from 'node:path';
import type { ErrorPayload as ViteErrorPayload } from 'vite';
export type MaybePromise<T> = T | Promise<T>;
/**
* Match YAML exception handling from Astro core errors
* @see 'astro/src/core/errors.ts'