@mintlify/common 1.0.1305 → 1.0.1307
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apiStaticExportBasePaths.d.ts +1 -1
- package/dist/asyncapi/parser/getExamplesData.js +4 -3
- package/dist/asyncapi/parser/getMessagesData.js +6 -5
- package/dist/asyncapi/parser/getOperationsData.js +4 -3
- package/dist/colors.js +9 -8
- package/dist/css/tailwind.d.ts +1 -1
- package/dist/css/tailwindInternals.d.ts +1 -1
- package/dist/entitlements/index.d.ts +1 -1
- package/dist/frontmatter/index.d.ts +1 -1
- package/dist/frontmatter/index.js +1 -1
- package/dist/frontmatter/parseFrontmatter.d.ts +1 -0
- package/dist/frontmatter/parseFrontmatter.js +1 -0
- package/dist/getDisplayDomain.js +2 -1
- package/dist/getFileCategory.d.ts +2 -2
- package/dist/graphql/resolveGraphqlOperation.d.ts +1 -1
- package/dist/isAbsoluteUrl.d.ts +1 -1
- package/dist/mdx/currencyMath.js +2 -1
- package/dist/mdx/getCodeStyling.d.ts +1 -1
- package/dist/mdx/getMDXOptions.d.ts +2 -2
- package/dist/mdx/islands/extractPackageIslands.js +6 -5
- package/dist/mdx/islands/island-bindings.js +4 -3
- package/dist/mdx/islands/island-module-builder.js +12 -13
- package/dist/mdx/islands/package-page-url.js +4 -2
- package/dist/mdx/islands/package-sources.js +5 -3
- package/dist/mdx/islands/packageImports.js +4 -3
- package/dist/mdx/islands/remarkPackageIslands.js +10 -8
- package/dist/mdx/lib/mdx-utils.d.ts +1 -1
- package/dist/mdx/page-style.js +2 -1
- package/dist/mdx/plugins/rehype/rehypeCodeBlocks/index.js +4 -3
- package/dist/mdx/plugins/rehype/rehypeCodeBlocks/metaOptions.d.ts +4 -4
- package/dist/mdx/plugins/rehype/rehypeCodeBlocks/metaOptions.js +8 -6
- package/dist/mdx/plugins/rehype/rehypeDynamicTailwindCss.js +4 -3
- package/dist/mdx/plugins/remark/pureTemplateComponents.js +6 -8
- package/dist/mdx/plugins/remark/remarkComponentIds.js +6 -8
- package/dist/mdx/plugins/remark/remarkExtractTableOfContents.js +11 -9
- package/dist/mdx/plugins/remark/remarkMdxExpandExpressions.js +10 -7
- package/dist/mdx/plugins/remark/remarkMdxRemoveJs.js +7 -8
- package/dist/mdx/plugins/remark/remarkMdxRemoveUnknownJsx/index.d.ts +1 -1
- package/dist/mdx/plugins/remark/remarkPrompt.js +1 -1
- package/dist/mdx/plugins/remark/remarkVisibilityForMarkdown.d.ts +1 -1
- package/dist/mdx/plugins/remark/remarkVisibilityForMarkdown.js +10 -8
- package/dist/mdx/plugins/remark/staticEvaluator.js +4 -2
- package/dist/mdx/plugins/remark/unfoldComponentsForMarkdown.js +2 -1
- package/dist/mdx/preprocessCustomHeadingIds.d.ts +1 -0
- package/dist/mdx/preprocessCustomHeadingIds.js +6 -5
- package/dist/mdx/server-only/getMdx.d.ts +1 -1
- package/dist/mdx/server-only/getMdx.js +2 -1
- package/dist/mdx/snippets/constants.d.ts +1 -1
- package/dist/mdx/snippets/isBareSpecifier.d.ts +1 -1
- package/dist/mdx/snippets/resolveAllImports.js +21 -29
- package/dist/mdx/snippets/resolveImport/snippetDeclarations.js +4 -7
- package/dist/mdx/utils.d.ts +1 -1
- package/dist/navigation/filterDivisions.js +1 -2
- package/dist/navigation/scopeNavToPath.d.ts +1 -1
- package/dist/navigation/scopeNavToPath.js +4 -4
- package/dist/navigation/updateFirstHrefInDivision.d.ts +1 -1
- package/dist/openapi/additionalOperations.js +6 -5
- package/dist/openapi/encodings.js +2 -1
- package/dist/openapi/generateOpenApiPages.js +17 -16
- package/dist/openapi/getTagDisplayName.d.ts +1 -1
- package/dist/openapi/overlay/errors.d.ts +1 -1
- package/dist/openapi/overlay/overlayRegistry.d.ts +1 -1
- package/dist/openapi/tagHierarchy.js +1 -1
- package/dist/seo/resolveSeoMetatags.js +4 -3
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/AnalyticsEvent.d.ts +2 -2
- package/package.json +3 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const API_STATIC_EXPORT_BASE_PATHS: readonly [
|
|
1
|
+
export declare const API_STATIC_EXPORT_BASE_PATHS: readonly ['', '/docs', '/documentation'];
|
|
2
2
|
export type ApiStaticExportBasePath = (typeof API_STATIC_EXPORT_BASE_PATHS)[number];
|
|
3
3
|
export declare function isApiStaticExportBasePath(basePath: string): basePath is ApiStaticExportBasePath;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { generateExampleFromSchema } from '@mintlify/validation';
|
|
2
2
|
export const getExamplesData = ({ message, jsonSchema, payloadSchema, extensions, }) => {
|
|
3
|
-
var _a, _b, _c
|
|
3
|
+
var _a, _b, _c;
|
|
4
|
+
var _d, _e;
|
|
4
5
|
const id = message.id().toLowerCase();
|
|
5
6
|
const examples = message.examples();
|
|
6
7
|
const hasInlineExamples = examples.length > 0;
|
|
@@ -9,8 +10,8 @@ export const getExamplesData = ({ message, jsonSchema, payloadSchema, extensions
|
|
|
9
10
|
return JSON.stringify(example, null, 2);
|
|
10
11
|
}
|
|
11
12
|
const jsonExamples = [
|
|
12
|
-
...((
|
|
13
|
-
...((_e = (
|
|
13
|
+
...((_d = jsonSchema['examples']) !== null && _d !== void 0 ? _d : []),
|
|
14
|
+
...((_e = (_c = jsonSchema['schema']) === null || _c === void 0 ? void 0 : _c['examples']) !== null && _e !== void 0 ? _e : []),
|
|
14
15
|
];
|
|
15
16
|
const hasJsonExamples = jsonExamples.length > 0;
|
|
16
17
|
if (hasJsonExamples) {
|
|
@@ -5,13 +5,14 @@ import { getExamplesData } from './getExamplesData.js';
|
|
|
5
5
|
import { getExtensionsData } from './getExtensionsData.js';
|
|
6
6
|
export const getMessagesData = (messages, extensions) => {
|
|
7
7
|
return messages.map((message) => {
|
|
8
|
-
var _a, _b
|
|
8
|
+
var _a, _b;
|
|
9
|
+
var _c, _d, _e;
|
|
9
10
|
const id = message.id();
|
|
10
|
-
const title = (
|
|
11
|
+
const title = (_d = (_c = message.title()) !== null && _c !== void 0 ? _c : message.name()) !== null && _d !== void 0 ? _d : message.id();
|
|
11
12
|
const niceTitle = title === id ? camelToSentenceCase(id) : title;
|
|
12
|
-
const description = (
|
|
13
|
-
const payload = (
|
|
14
|
-
const headers = (
|
|
13
|
+
const description = (_e = message.summary()) !== null && _e !== void 0 ? _e : message.description();
|
|
14
|
+
const payload = (_a = message.payload()) === null || _a === void 0 ? void 0 : _a['_json'];
|
|
15
|
+
const headers = (_b = message.headers()) === null || _b === void 0 ? void 0 : _b['_json'];
|
|
15
16
|
const payloadSchema = getMessagePayloadSchema(title, description, payload);
|
|
16
17
|
const example = getExamplesData({ message, jsonSchema: payload, payloadSchema, extensions });
|
|
17
18
|
return {
|
|
@@ -3,9 +3,10 @@ import { getBindingsData } from './getBindingsData.js';
|
|
|
3
3
|
import { getMessagesData } from './getMessagesData.js';
|
|
4
4
|
export const getOperationsData = (operations, extensions) => {
|
|
5
5
|
return operations.map((operation) => {
|
|
6
|
-
var _a
|
|
7
|
-
|
|
8
|
-
const
|
|
6
|
+
var _a;
|
|
7
|
+
var _b, _c, _d;
|
|
8
|
+
const id = (_b = operation.operationId()) !== null && _b !== void 0 ? _b : operation.id();
|
|
9
|
+
const title = (_c = (_a = operation['_json']) === null || _a === void 0 ? void 0 : _a.title) !== null && _c !== void 0 ? _c : id;
|
|
9
10
|
const type = operation.action();
|
|
10
11
|
const niceTitle = id && title === id ? camelToSentenceCase(id) : title;
|
|
11
12
|
const description = (_d = operation.summary()) !== null && _d !== void 0 ? _d : operation.description();
|
package/dist/colors.js
CHANGED
|
@@ -104,22 +104,23 @@ export const getDefaultBackgroundColors = (primaryLight = DEFAULT_PRIMARY_LIGHT)
|
|
|
104
104
|
dark: generateDynamicBackgroundDarkColor(primaryLight, undefined, true),
|
|
105
105
|
});
|
|
106
106
|
export function getBackgroundColors(docsConfig) {
|
|
107
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l
|
|
107
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
108
|
+
var _m, _o;
|
|
108
109
|
const primaryColor = (docsConfig === null || docsConfig === void 0 ? void 0 : docsConfig.colors.primary) || '#16A34A';
|
|
109
|
-
const primaryLight = (
|
|
110
|
+
const primaryLight = (_m = docsConfig === null || docsConfig === void 0 ? void 0 : docsConfig.colors.light) !== null && _m !== void 0 ? _m : DEFAULT_PRIMARY_LIGHT;
|
|
110
111
|
if ((docsConfig === null || docsConfig === void 0 ? void 0 : docsConfig.theme) === 'linden') {
|
|
111
112
|
docsConfig.background = Object.assign(Object.assign({}, docsConfig.background), { color: {
|
|
112
|
-
light: ((
|
|
113
|
+
light: ((_b = (_a = docsConfig.background) === null || _a === void 0 ? void 0 : _a.color) === null || _b === void 0 ? void 0 : _b.light) ||
|
|
113
114
|
rgbToHex(combineColors('#FFFFFF', 1, primaryColor, 0.03)),
|
|
114
|
-
dark: ((
|
|
115
|
+
dark: ((_d = (_c = docsConfig.background) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d.dark) ||
|
|
115
116
|
rgbToHex(combineColors('#09090B', 1, primaryLight, 0.03)),
|
|
116
117
|
} });
|
|
117
118
|
}
|
|
118
|
-
const lightHex = (
|
|
119
|
+
const lightHex = (_o = (_f = (_e = docsConfig === null || docsConfig === void 0 ? void 0 : docsConfig.background) === null || _e === void 0 ? void 0 : _e.color) === null || _f === void 0 ? void 0 : _f.light) !== null && _o !== void 0 ? _o : '#ffffff';
|
|
119
120
|
const light = hexToRgbString(lightHex);
|
|
120
|
-
const dark = generateDynamicBackgroundDarkColor(primaryLight, (
|
|
121
|
-
const darkHex = generateDynamicBackgroundDarkColor(primaryLight, (
|
|
122
|
-
const background = (
|
|
121
|
+
const dark = generateDynamicBackgroundDarkColor(primaryLight, (_h = (_g = docsConfig === null || docsConfig === void 0 ? void 0 : docsConfig.background) === null || _g === void 0 ? void 0 : _g.color) === null || _h === void 0 ? void 0 : _h.dark);
|
|
122
|
+
const darkHex = generateDynamicBackgroundDarkColor(primaryLight, (_k = (_j = docsConfig === null || docsConfig === void 0 ? void 0 : docsConfig.background) === null || _j === void 0 ? void 0 : _j.color) === null || _k === void 0 ? void 0 : _k.dark, true);
|
|
123
|
+
const background = (_l = docsConfig === null || docsConfig === void 0 ? void 0 : docsConfig.thumbnails) === null || _l === void 0 ? void 0 : _l.background;
|
|
123
124
|
return {
|
|
124
125
|
light,
|
|
125
126
|
dark,
|
package/dist/css/tailwind.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Get generated TailwindCSS from the content with prefix added to each class */
|
|
2
|
-
export declare function getDynamicTailwindCss({ content, prefix
|
|
2
|
+
export declare function getDynamicTailwindCss({ content, prefix }: {
|
|
3
3
|
content: string;
|
|
4
4
|
prefix?: string;
|
|
5
5
|
}): Promise<string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { TailwindContext } from 'tailwindcss-v3/lib/lib/setupContextUtils.js';
|
|
2
2
|
export { default as resolveConfig } from 'tailwindcss-v3/resolveConfig.js';
|
|
3
|
-
export declare const createContext: (config: ReturnType<typeof import(
|
|
3
|
+
export declare const createContext: (config: ReturnType<typeof import('tailwindcss-v3/resolveConfig.js')>) => import("tailwindcss-v3/lib/lib/setupContextUtils.js").TailwindContext;
|
|
4
4
|
export declare const generateRules: (candidates: Set<string>, context: import("tailwindcss-v3/lib/lib/setupContextUtils.js").TailwindContext) => import("tailwindcss-v3/lib/lib/setupContextUtils.js").RuleEntry[];
|
|
5
5
|
export declare const defaultExtractor: (context: import("tailwindcss-v3/lib/lib/setupContextUtils.js").TailwindContext) => (content: string) => string[];
|
|
6
6
|
export declare const NOT_ON_DEMAND: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OrgType, StaticPropsOrgType } from '@mintlify/models';
|
|
2
2
|
import { DeploymentEntitlement, DeploymentEntitlements } from '@mintlify/validation';
|
|
3
3
|
export declare const TRIAL_ENTITLEMENTS: DeploymentEntitlement[];
|
|
4
|
-
export declare function checkAccess({ entitlements, org, entitlementToCheck, allowTrialAccess
|
|
4
|
+
export declare function checkAccess({ entitlements, org, entitlementToCheck, allowTrialAccess }: {
|
|
5
5
|
entitlements: DeploymentEntitlements | undefined;
|
|
6
6
|
org?: OrgType | StaticPropsOrgType;
|
|
7
7
|
entitlementToCheck: DeploymentEntitlement;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { parseFrontmatter, hasFrontmatter } from './parseFrontmatter.js';
|
|
1
|
+
export { FRONTMATTER_RE, parseFrontmatter, hasFrontmatter } from './parseFrontmatter.js';
|
|
2
2
|
export type { FrontmatterAttributes } from './parseFrontmatter.js';
|
|
3
3
|
export type { FrontMatterResult } from 'front-matter';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { parseFrontmatter, hasFrontmatter } from './parseFrontmatter.js';
|
|
1
|
+
export { FRONTMATTER_RE, parseFrontmatter, hasFrontmatter } from './parseFrontmatter.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fm from 'front-matter';
|
|
2
2
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
3
3
|
const frontmatter = fm;
|
|
4
|
+
export const FRONTMATTER_RE = /^?(---|\+\+\+)\r?\n[\s\S]*?\r?\n\1[ \t]*(?=\r?\n|$)/;
|
|
4
5
|
/**
|
|
5
6
|
* Type-safe wrapper for parsing front-matter from markdown content.
|
|
6
7
|
*
|
package/dist/getDisplayDomain.js
CHANGED
|
@@ -25,7 +25,8 @@ function getSubdomain(deployment) {
|
|
|
25
25
|
return 'mintlify.site';
|
|
26
26
|
}
|
|
27
27
|
export function getDisplayDomain(deployment, isDev = false, appendBasePath = true) {
|
|
28
|
-
var _a, _b, _c
|
|
28
|
+
var _a, _b, _c;
|
|
29
|
+
var _d;
|
|
29
30
|
const { subdomain } = deployment;
|
|
30
31
|
if ((_a = deployment.atlas) === null || _a === void 0 ? void 0 : _a.repoUrl) {
|
|
31
32
|
const parsed = parseOwnerRepo(deployment.atlas.repoUrl);
|
|
@@ -3,9 +3,9 @@ export type FileCategoryOptions = {
|
|
|
3
3
|
};
|
|
4
4
|
export type PotentialFileCategory = 'page' | 'snippet' | 'mintConfig' | 'potentialYamlOpenApiSpec' | 'potentialJsonOpenApiSpec' | 'staticFile' | 'snippet-v2' | 'css' | 'js' | 'docsConfig' | 'generatedStaticFile' | 'skillFile' | 'mintIgnore' | null;
|
|
5
5
|
export type FileCategory = Omit<PotentialFileCategory, 'potentialYamlOpenApiSpec' | 'potentialJsonOpenApiSpec'> | 'openApi' | null;
|
|
6
|
-
export declare const generatedStaticFiles: readonly [
|
|
6
|
+
export declare const generatedStaticFiles: readonly ['llms.txt', 'robots.txt', 'sitemap.xml', 'llms-full.txt'];
|
|
7
7
|
export type GeneratedStaticFile = (typeof generatedStaticFiles)[number];
|
|
8
|
-
export declare const packageManifestFiles: readonly [
|
|
8
|
+
export declare const packageManifestFiles: readonly ['package.json', 'package-lock.json', 'pnpm-lock.yaml'];
|
|
9
9
|
export type PackageManifestFile = (typeof packageManifestFiles)[number];
|
|
10
10
|
export declare const isPackageManifestPath: (filePath: string) => boolean;
|
|
11
11
|
export declare const IMAGE_FORMATS: string[];
|
|
@@ -4,4 +4,4 @@ export type ResolvedGraphqlOperation = {
|
|
|
4
4
|
field: GraphqlField;
|
|
5
5
|
parents: GraphqlField[];
|
|
6
6
|
};
|
|
7
|
-
export declare const resolveGraphqlOperation: (reference: GraphqlReference, target: Pick<GraphqlTarget,
|
|
7
|
+
export declare const resolveGraphqlOperation: (reference: GraphqlReference, target: Pick<GraphqlTarget, 'kind' | 'name'>) => ResolvedGraphqlOperation | undefined;
|
package/dist/isAbsoluteUrl.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const protocols: readonly [
|
|
1
|
+
declare const protocols: readonly ['http', 'https', 'ftp', 'ftps', 'file', 'data', 'mailto', 'tel', 'sms', 'ws', 'wss'];
|
|
2
2
|
type Protocol = (typeof protocols)[number];
|
|
3
3
|
export type AbsoluteUrl = `${Protocol}://${string}` | `${Protocol}:${string}`;
|
|
4
4
|
/**
|
package/dist/mdx/currencyMath.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SKIP, visit } from 'unist-util-visit';
|
|
2
2
|
export const isCurrencyMath = (node, text) => {
|
|
3
|
-
var _a, _b
|
|
3
|
+
var _a, _b;
|
|
4
|
+
var _c;
|
|
4
5
|
const start = (_a = node.position) === null || _a === void 0 ? void 0 : _a.start.offset;
|
|
5
6
|
const end = (_b = node.position) === null || _b === void 0 ? void 0 : _b.end.offset;
|
|
6
7
|
if (start === undefined || end === undefined)
|
|
@@ -9,4 +9,4 @@ export declare const codeStylingToThemeOrThemes: (codeStylingFromConfig: CodeSty
|
|
|
9
9
|
dark: ShikiThemeType;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
export declare const getCodeStylingEnum: (codeStylingFromConfig: CodeStyling) =>
|
|
12
|
+
export declare const getCodeStylingEnum: (codeStylingFromConfig: CodeStyling) => 'system' | 'dark';
|
|
@@ -26,7 +26,7 @@ export declare const getMDXOptions: ({ data, remarkPlugins, earlyRemarkPlugins,
|
|
|
26
26
|
remarkPlugins: PluggableList;
|
|
27
27
|
rehypePlugins: PluggableList;
|
|
28
28
|
};
|
|
29
|
-
packageIslands?: Omit<RemarkPackageIslandsOptions,
|
|
29
|
+
packageIslands?: Omit<RemarkPackageIslandsOptions, 'mdxExtracts'>;
|
|
30
30
|
detectJs?: MdxJsDetection;
|
|
31
|
-
}) => SerializeOptions[
|
|
31
|
+
}) => SerializeOptions['mdxOptions'];
|
|
32
32
|
export {};
|
|
@@ -54,7 +54,8 @@ export const extractPackageIslands = (tree, options) => {
|
|
|
54
54
|
const tightItems = new WeakSet();
|
|
55
55
|
const placements = new Map();
|
|
56
56
|
const visitChildren = (parent, blocker, outside = blocker, via) => {
|
|
57
|
-
var _a, _b, _c, _d
|
|
57
|
+
var _a, _b, _c, _d;
|
|
58
|
+
var _e;
|
|
58
59
|
for (const child of parent.children) {
|
|
59
60
|
if (child.type === 'mdxJsxFlowElement' || child.type === 'mdxJsxTextElement') {
|
|
60
61
|
const head = child.name ? bindingHead(child.name) : undefined;
|
|
@@ -83,7 +84,7 @@ export const extractPackageIslands = (tree, options) => {
|
|
|
83
84
|
}
|
|
84
85
|
const base = builder.module(element);
|
|
85
86
|
const baseId = islandIdFor(base);
|
|
86
|
-
const placement = ((
|
|
87
|
+
const placement = ((_e = placements.get(baseId)) !== null && _e !== void 0 ? _e : 0) + 1;
|
|
87
88
|
placements.set(baseId, placement);
|
|
88
89
|
const module = placement === 1 ? base : withPlacement(base, placement);
|
|
89
90
|
const id = placement === 1 ? baseId : islandIdFor(module);
|
|
@@ -115,10 +116,10 @@ export const extractPackageIslands = (tree, options) => {
|
|
|
115
116
|
for (const attribute of child.attributes) {
|
|
116
117
|
let estree;
|
|
117
118
|
if (attribute.type === 'mdxJsxExpressionAttribute') {
|
|
118
|
-
estree = (
|
|
119
|
+
estree = (_a = attribute.data) === null || _a === void 0 ? void 0 : _a.estree;
|
|
119
120
|
}
|
|
120
121
|
else if (typeof attribute.value === 'object') {
|
|
121
|
-
estree = (
|
|
122
|
+
estree = (_c = (_b = attribute.value) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.estree;
|
|
122
123
|
}
|
|
123
124
|
if (estree)
|
|
124
125
|
reportReferences(estree, lineOf(child));
|
|
@@ -135,7 +136,7 @@ export const extractPackageIslands = (tree, options) => {
|
|
|
135
136
|
continue;
|
|
136
137
|
}
|
|
137
138
|
if (child.type === 'mdxFlowExpression' || child.type === 'mdxTextExpression') {
|
|
138
|
-
if ((
|
|
139
|
+
if ((_d = child.data) === null || _d === void 0 ? void 0 : _d.estree)
|
|
139
140
|
reportReferences(child.data.estree, lineOf(child));
|
|
140
141
|
continue;
|
|
141
142
|
}
|
|
@@ -16,11 +16,12 @@ const importedName = (specifier) => {
|
|
|
16
16
|
export const esmStatements = (tree, pagePath) => {
|
|
17
17
|
const statements = [];
|
|
18
18
|
const visitNode = (node) => {
|
|
19
|
-
var _a, _b, _c
|
|
19
|
+
var _a, _b, _c;
|
|
20
|
+
var _d, _e;
|
|
20
21
|
if (isMdxJsEsm(node)) {
|
|
21
22
|
const importer = importingFile(node, pagePath);
|
|
22
|
-
for (const statement of (
|
|
23
|
-
statements.push({ statement, line: (_e = (
|
|
23
|
+
for (const statement of (_d = (_b = (_a = node.data) === null || _a === void 0 ? void 0 : _a.estree) === null || _b === void 0 ? void 0 : _b.body) !== null && _d !== void 0 ? _d : []) {
|
|
24
|
+
statements.push({ statement, line: (_e = (_c = statement.loc) === null || _c === void 0 ? void 0 : _c.start.line) !== null && _e !== void 0 ? _e : lineOf(node), importer });
|
|
24
25
|
}
|
|
25
26
|
return;
|
|
26
27
|
}
|
|
@@ -312,7 +312,8 @@ export class IslandModuleBuilder {
|
|
|
312
312
|
return result;
|
|
313
313
|
}
|
|
314
314
|
child(node) {
|
|
315
|
-
var _a
|
|
315
|
+
var _a;
|
|
316
|
+
var _b;
|
|
316
317
|
switch (node.type) {
|
|
317
318
|
case 'mdxJsxFlowElement':
|
|
318
319
|
case 'mdxJsxTextElement': {
|
|
@@ -356,7 +357,7 @@ export class IslandModuleBuilder {
|
|
|
356
357
|
case 'image': {
|
|
357
358
|
const attributes = [
|
|
358
359
|
jsxAttribute('src', this.url(node.url, false)),
|
|
359
|
-
jsxAttribute('alt', literal((
|
|
360
|
+
jsxAttribute('alt', literal((_b = node.alt) !== null && _b !== void 0 ? _b : '')),
|
|
360
361
|
];
|
|
361
362
|
if (node.title)
|
|
362
363
|
attributes.push(jsxAttribute('title', literal(node.title)));
|
|
@@ -395,7 +396,7 @@ export class IslandModuleBuilder {
|
|
|
395
396
|
}
|
|
396
397
|
case 'mdxFlowExpression':
|
|
397
398
|
case 'mdxTextExpression': {
|
|
398
|
-
const program = (
|
|
399
|
+
const program = (_a = node.data) === null || _a === void 0 ? void 0 : _a.estree;
|
|
399
400
|
if (program && program.body.length === 0)
|
|
400
401
|
return [];
|
|
401
402
|
const statement = program === null || program === void 0 ? void 0 : program.body[0];
|
|
@@ -414,12 +415,9 @@ export class IslandModuleBuilder {
|
|
|
414
415
|
}
|
|
415
416
|
}
|
|
416
417
|
listItem(item, loose) {
|
|
417
|
-
const results = unravel(item.children).map((child) => {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
? { p: true, empty: child.children.length === 0, children: this.children(child.children) }
|
|
421
|
-
: { p: false, empty: false, children: (_a = this.child(child)) !== null && _a !== void 0 ? _a : [] };
|
|
422
|
-
});
|
|
418
|
+
const results = unravel(item.children).map((child) => { var _a; return child.type === 'paragraph'
|
|
419
|
+
? { p: true, empty: child.children.length === 0, children: this.children(child.children) }
|
|
420
|
+
: { p: false, empty: false, children: (_a = this.child(child)) !== null && _a !== void 0 ? _a : [] }; });
|
|
423
421
|
const attributes = [];
|
|
424
422
|
if (typeof item.checked === 'boolean') {
|
|
425
423
|
const checkbox = jsxElement('input', [
|
|
@@ -456,17 +454,18 @@ export class IslandModuleBuilder {
|
|
|
456
454
|
return value !== undefined && this.isRenderableText(value) && value.type !== 'Identifier';
|
|
457
455
|
}
|
|
458
456
|
module(root) {
|
|
459
|
-
var _a
|
|
457
|
+
var _a;
|
|
458
|
+
var _b, _c;
|
|
460
459
|
const body = [];
|
|
461
460
|
const bySource = new Map();
|
|
462
461
|
for (const binding of [...this.usedBindings.values()].sort((a, b) => compare(a.local, b.local))) {
|
|
463
|
-
bySource.set(binding.source, [...((
|
|
462
|
+
bySource.set(binding.source, [...((_b = bySource.get(binding.source)) !== null && _b !== void 0 ? _b : []), binding]);
|
|
464
463
|
}
|
|
465
464
|
const sources = this.sideEffects.size === 0
|
|
466
465
|
? [...bySource.keys()].sort(compare)
|
|
467
466
|
: this.order.filter((source) => bySource.has(source) || this.sideEffects.has(source));
|
|
468
467
|
for (const source of sources) {
|
|
469
|
-
const bindings = (
|
|
468
|
+
const bindings = (_c = bySource.get(source)) !== null && _c !== void 0 ? _c : [];
|
|
470
469
|
const declaration = (specifiers) => ({
|
|
471
470
|
type: 'ImportDeclaration',
|
|
472
471
|
specifiers,
|
|
@@ -499,7 +498,7 @@ export class IslandModuleBuilder {
|
|
|
499
498
|
}
|
|
500
499
|
}
|
|
501
500
|
for (const name of [...this.usedConsts].sort(compare)) {
|
|
502
|
-
const expression = (
|
|
501
|
+
const expression = (_a = this.consts.get(name)) === null || _a === void 0 ? void 0 : _a.expression;
|
|
503
502
|
if (!expression)
|
|
504
503
|
continue;
|
|
505
504
|
body.push({
|
|
@@ -38,7 +38,8 @@ export function packagePageBaseUrl(baseUrl, pagePath) {
|
|
|
38
38
|
return `${baseUrl}/pages/${token}`;
|
|
39
39
|
}
|
|
40
40
|
export function packagePageStylesheets(baseUrl, pagePath, islandIds, manifest) {
|
|
41
|
-
var _a
|
|
41
|
+
var _a;
|
|
42
|
+
var _b;
|
|
42
43
|
const pageBaseUrl = packagePageBaseUrl(baseUrl, pagePath);
|
|
43
44
|
const paths = new Set(manifest.css.map((css) => css.path));
|
|
44
45
|
for (const id of [...islandIds].sort()) {
|
|
@@ -52,7 +53,8 @@ export function compilePackageBuild(packageBuild) {
|
|
|
52
53
|
return packageBuild && hasIslands(packageBuild) ? packageBuild : undefined;
|
|
53
54
|
}
|
|
54
55
|
export function withPackageGlobalStylesheets(mdxExtracts, packageBuild, pagePath) {
|
|
55
|
-
var _a
|
|
56
|
+
var _a;
|
|
57
|
+
var _b;
|
|
56
58
|
if (!((_a = packageBuild === null || packageBuild === void 0 ? void 0 : packageBuild.css) === null || _a === void 0 ? void 0 : _a.length))
|
|
57
59
|
return mdxExtracts;
|
|
58
60
|
let globalFiles;
|
|
@@ -32,11 +32,13 @@ const MODULE_SOURCE_STATEMENTS = new Set([
|
|
|
32
32
|
'ExportAllDeclaration',
|
|
33
33
|
]);
|
|
34
34
|
const topLevelSources = (tree, statementTypes = IMPORT_STATEMENTS) => tree.children.flatMap((node) => {
|
|
35
|
-
var _a, _b
|
|
35
|
+
var _a, _b;
|
|
36
|
+
var _c;
|
|
36
37
|
if (!isMdxJsEsm(node))
|
|
37
38
|
return [];
|
|
38
39
|
return ((_c = (_b = (_a = node.data) === null || _a === void 0 ? void 0 : _a.estree) === null || _b === void 0 ? void 0 : _b.body) !== null && _c !== void 0 ? _c : []).flatMap((statement) => {
|
|
39
|
-
var _a, _b, _c
|
|
40
|
+
var _a, _b, _c;
|
|
41
|
+
var _d;
|
|
40
42
|
if (!statementTypes.has(statement.type) ||
|
|
41
43
|
!('source' in statement) ||
|
|
42
44
|
typeof ((_a = statement.source) === null || _a === void 0 ? void 0 : _a.value) !== 'string') {
|
|
@@ -45,7 +47,7 @@ const topLevelSources = (tree, statementTypes = IMPORT_STATEMENTS) => tree.child
|
|
|
45
47
|
return [
|
|
46
48
|
{
|
|
47
49
|
source: statement.source.value,
|
|
48
|
-
line: (
|
|
50
|
+
line: (_d = (_b = statement.loc) === null || _b === void 0 ? void 0 : _b.start.line) !== null && _d !== void 0 ? _d : (_c = node.position) === null || _c === void 0 ? void 0 : _c.start.line,
|
|
49
51
|
},
|
|
50
52
|
];
|
|
51
53
|
});
|
|
@@ -30,18 +30,19 @@ export const isPackageSnippetPath = (path) => {
|
|
|
30
30
|
};
|
|
31
31
|
export const isPackageSnippet = (filename, importSources) => isPackageSnippetPath(filename) && importSources.some(isNonHostBareImport);
|
|
32
32
|
const moduleSources = (tree) => {
|
|
33
|
-
var _a, _b, _c
|
|
33
|
+
var _a, _b, _c;
|
|
34
|
+
var _d;
|
|
34
35
|
const sources = [];
|
|
35
36
|
for (const node of tree.children) {
|
|
36
37
|
if (!isMdxJsEsm(node))
|
|
37
38
|
continue;
|
|
38
|
-
for (const statement of (
|
|
39
|
+
for (const statement of (_d = (_b = (_a = node.data) === null || _a === void 0 ? void 0 : _a.estree) === null || _b === void 0 ? void 0 : _b.body) !== null && _d !== void 0 ? _d : []) {
|
|
39
40
|
if (statement.type !== 'ImportDeclaration' &&
|
|
40
41
|
statement.type !== 'ExportNamedDeclaration' &&
|
|
41
42
|
statement.type !== 'ExportAllDeclaration') {
|
|
42
43
|
continue;
|
|
43
44
|
}
|
|
44
|
-
const source = (
|
|
45
|
+
const source = (_c = statement.source) === null || _c === void 0 ? void 0 : _c.value;
|
|
45
46
|
if (typeof source === 'string')
|
|
46
47
|
sources.push(source);
|
|
47
48
|
}
|
|
@@ -83,9 +83,10 @@ const removeIslandImports = (tree, options) => {
|
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
85
|
export const remarkPackageIslands = (options) => (tree) => {
|
|
86
|
-
var _a
|
|
86
|
+
var _a;
|
|
87
|
+
var _b, _c;
|
|
87
88
|
const own = extractPackageIslands(tree, options);
|
|
88
|
-
const plan = (
|
|
89
|
+
const plan = (_b = options.plan) !== null && _b !== void 0 ? _b : own;
|
|
89
90
|
if (plan.errors.length > 0)
|
|
90
91
|
throw new PackageIslandsError(options.pagePath, plan.errors);
|
|
91
92
|
if (own.errors.length > 0)
|
|
@@ -102,8 +103,9 @@ export const remarkPackageIslands = (options) => (tree) => {
|
|
|
102
103
|
const headings = new Map();
|
|
103
104
|
const buildErrors = [];
|
|
104
105
|
own.roots.forEach((root, index) => {
|
|
105
|
-
var _a, _b, _c, _d
|
|
106
|
-
|
|
106
|
+
var _a, _b, _c, _d;
|
|
107
|
+
var _e;
|
|
108
|
+
const id = (_e = (_a = plan.roots[index]) === null || _a === void 0 ? void 0 : _a.id) !== null && _e !== void 0 ? _e : root.id;
|
|
107
109
|
ids.set(root.node, id);
|
|
108
110
|
headings.set(root.node, root.headings);
|
|
109
111
|
if (!options.islandHtml)
|
|
@@ -111,20 +113,20 @@ export const remarkPackageIslands = (options) => (tree) => {
|
|
|
111
113
|
const entry = options.islandHtml[id];
|
|
112
114
|
if (entry === undefined) {
|
|
113
115
|
buildErrors.push({
|
|
114
|
-
line: (
|
|
116
|
+
line: (_b = root.node.position) === null || _b === void 0 ? void 0 : _b.start.line,
|
|
115
117
|
message: `<${root.name}> compiles to island ${id}, which isn't in the package build.`,
|
|
116
118
|
});
|
|
117
119
|
return;
|
|
118
120
|
}
|
|
119
121
|
if (entry.prefix !== islandPrefixFor(id)) {
|
|
120
122
|
buildErrors.push({
|
|
121
|
-
line: (
|
|
123
|
+
line: (_c = root.node.position) === null || _c === void 0 ? void 0 : _c.start.line,
|
|
122
124
|
message: `Island ${id} must use the prefix ${islandPrefixFor(id)}.`,
|
|
123
125
|
});
|
|
124
126
|
}
|
|
125
127
|
if (entry.html !== undefined && typeof entry.html !== 'string') {
|
|
126
128
|
buildErrors.push({
|
|
127
|
-
line: (
|
|
129
|
+
line: (_d = root.node.position) === null || _d === void 0 ? void 0 : _d.start.line,
|
|
128
130
|
message: `Island ${id} HTML must be a string.`,
|
|
129
131
|
});
|
|
130
132
|
}
|
|
@@ -158,7 +160,7 @@ export const remarkPackageIslands = (options) => (tree) => {
|
|
|
158
160
|
for (const id of ids.values()) {
|
|
159
161
|
if (id in islands)
|
|
160
162
|
continue;
|
|
161
|
-
const entry = (
|
|
163
|
+
const entry = (_a = options.islandHtml) === null || _a === void 0 ? void 0 : _a[id];
|
|
162
164
|
islands[id] = Object.assign(Object.assign({}, ((entry === null || entry === void 0 ? void 0 : entry.html) !== undefined && { html: entry.html })), { prefix: (_c = entry === null || entry === void 0 ? void 0 : entry.prefix) !== null && _c !== void 0 ? _c : islandPrefixFor(id) });
|
|
163
165
|
}
|
|
164
166
|
options.mdxExtracts.islands = islands;
|
|
@@ -2,7 +2,7 @@ import { MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElementHast } fro
|
|
|
2
2
|
import { Node } from 'unist';
|
|
3
3
|
export declare const isMdxJsxFlowElementHast: (node: Node) => node is MdxJsxFlowElementHast;
|
|
4
4
|
export declare const isMdxJsxAttribute: (attribute: MdxJsxAttribute | MdxJsxExpressionAttribute) => attribute is MdxJsxAttribute;
|
|
5
|
-
export declare const paramFieldLocations: readonly [
|
|
5
|
+
export declare const paramFieldLocations: readonly ['body', 'query', 'auth', 'cookie', 'path', 'header'];
|
|
6
6
|
export type ParamFieldLocation = (typeof paramFieldLocations)[number];
|
|
7
7
|
export type FieldLocation = ParamFieldLocation | 'response';
|
|
8
8
|
export declare const isParamFieldLocation: (str: string | undefined) => str is ParamFieldLocation;
|
package/dist/mdx/page-style.js
CHANGED
|
@@ -124,7 +124,8 @@ function styleChildren(element) {
|
|
|
124
124
|
: children;
|
|
125
125
|
}
|
|
126
126
|
function staticString(source) {
|
|
127
|
-
var _a
|
|
127
|
+
var _a;
|
|
128
|
+
var _b;
|
|
128
129
|
try {
|
|
129
130
|
const expression = parseExpressionAt(source, 0, { ecmaVersion: 'latest' });
|
|
130
131
|
if (source.slice(expression.end).trim() !== '')
|
|
@@ -10,7 +10,8 @@ function isElement(node, key = 'type', element = 'element') {
|
|
|
10
10
|
}
|
|
11
11
|
function addCodeBlocks(tree) {
|
|
12
12
|
visit(tree, (node, i, parent) => {
|
|
13
|
-
var _a, _b
|
|
13
|
+
var _a, _b;
|
|
14
|
+
var _c;
|
|
14
15
|
if (parent == null || i == null || !isElement(node) || !isElement(node, 'tagName', 'pre')) {
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
@@ -25,12 +26,12 @@ function addCodeBlocks(tree) {
|
|
|
25
26
|
const parentType = parentName.slice(0, -7);
|
|
26
27
|
meta = parseMetaString(parentType);
|
|
27
28
|
if (!((_a = code.data) === null || _a === void 0 ? void 0 : _a.meta)) {
|
|
28
|
-
const data = (
|
|
29
|
+
const data = (_c = code.data) !== null && _c !== void 0 ? _c : {};
|
|
29
30
|
data.meta = i === 0 ? parentType : `${parentType} ${i + 1}`;
|
|
30
31
|
code.data = data;
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
if (((
|
|
34
|
+
if (((_b = code.data) === null || _b === void 0 ? void 0 : _b.meta) && typeof code.data.meta === 'string') {
|
|
34
35
|
meta = parseMetaString(code.data.meta);
|
|
35
36
|
}
|
|
36
37
|
const attributes = buildMetaAttributes(meta !== null && meta !== void 0 ? meta : {});
|
|
@@ -51,22 +51,22 @@ export declare class MetaOptions {
|
|
|
51
51
|
* Allows to filter the options by {@link MetaOptionKind}.
|
|
52
52
|
* If omitted, no kind-based filtering will be applied.
|
|
53
53
|
*/
|
|
54
|
-
list<K extends MetaOptionKind | undefined = undefined>(keyOrKeys?: string | string[], kind?: K): K extends "
|
|
54
|
+
list<K extends MetaOptionKind | undefined = undefined>(keyOrKeys?: string | string[], kind?: K): K extends "boolean" | "range" | "regexp" | "string" ? (Extract<MetaOptionBoolean, {
|
|
55
55
|
kind: K;
|
|
56
56
|
}> | Extract<MetaOptionRange, {
|
|
57
57
|
kind: K;
|
|
58
58
|
}> | Extract<MetaOptionRegExp, {
|
|
59
59
|
kind: K;
|
|
60
|
-
}> | Extract<
|
|
60
|
+
}> | Extract<MetaOptionString, {
|
|
61
61
|
kind: K;
|
|
62
62
|
}>)[] : MetaOption[];
|
|
63
|
-
value<K extends MetaOptionKind | undefined = undefined>(key: string, kind?: K): (K extends "
|
|
63
|
+
value<K extends MetaOptionKind | undefined = undefined>(key: string, kind?: K): (K extends "boolean" | "range" | "regexp" | "string" ? Extract<MetaOptionBoolean, {
|
|
64
64
|
kind: K;
|
|
65
65
|
}> | Extract<MetaOptionRange, {
|
|
66
66
|
kind: K;
|
|
67
67
|
}> | Extract<MetaOptionRegExp, {
|
|
68
68
|
kind: K;
|
|
69
|
-
}> | Extract<
|
|
69
|
+
}> | Extract<MetaOptionString, {
|
|
70
70
|
kind: K;
|
|
71
71
|
}> : MetaOption)["value"] | undefined;
|
|
72
72
|
/**
|
|
@@ -103,7 +103,8 @@ export class MetaOptions {
|
|
|
103
103
|
.filter((value) => !isNaN(value));
|
|
104
104
|
}
|
|
105
105
|
getStringsWithInteger(keyOrKeys) {
|
|
106
|
-
var _a, _b
|
|
106
|
+
var _a, _b;
|
|
107
|
+
var _c, _d;
|
|
107
108
|
const strings = this.getStrings(keyOrKeys);
|
|
108
109
|
const integers = [];
|
|
109
110
|
for (const string of strings) {
|
|
@@ -113,8 +114,8 @@ export class MetaOptions {
|
|
|
113
114
|
if (trimmed.includes('-')) {
|
|
114
115
|
const rangeParts = trimmed.split('-');
|
|
115
116
|
if (rangeParts.length === 2) {
|
|
116
|
-
const start = parseInt((
|
|
117
|
-
const end = parseInt((_d = (
|
|
117
|
+
const start = parseInt((_c = (_a = rangeParts[0]) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _c !== void 0 ? _c : '', 10);
|
|
118
|
+
const end = parseInt((_d = (_b = rangeParts[1]) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _d !== void 0 ? _d : '', 10);
|
|
118
119
|
if (!isNaN(start) && !isNaN(end)) {
|
|
119
120
|
for (let i = start; i <= end; i++) {
|
|
120
121
|
integers.push(i);
|
|
@@ -139,7 +140,8 @@ export class MetaOptions {
|
|
|
139
140
|
* Works with range values (`{value}`) that contain comma-separated integers and ranges.
|
|
140
141
|
*/
|
|
141
142
|
getRangesWithInteger(keyOrKeys) {
|
|
142
|
-
var _a, _b
|
|
143
|
+
var _a, _b;
|
|
144
|
+
var _c, _d;
|
|
143
145
|
const ranges = this.getRanges(keyOrKeys);
|
|
144
146
|
const integers = [];
|
|
145
147
|
for (const range of ranges) {
|
|
@@ -149,8 +151,8 @@ export class MetaOptions {
|
|
|
149
151
|
if (trimmed.includes('-')) {
|
|
150
152
|
const rangeParts = trimmed.split('-');
|
|
151
153
|
if (rangeParts.length === 2) {
|
|
152
|
-
const start = parseInt((
|
|
153
|
-
const end = parseInt((_d = (
|
|
154
|
+
const start = parseInt((_c = (_a = rangeParts[0]) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _c !== void 0 ? _c : '', 10);
|
|
155
|
+
const end = parseInt((_d = (_b = rangeParts[1]) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _d !== void 0 ? _d : '', 10);
|
|
154
156
|
if (!isNaN(start) && !isNaN(end)) {
|
|
155
157
|
for (let i = start; i <= end; i++) {
|
|
156
158
|
integers.push(i);
|