@graphql-markdown/nuxt-theme 0.1.1 → 0.1.3

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.
@@ -19,7 +19,7 @@ interface RawPage {
19
19
  path: string;
20
20
  title: string;
21
21
  isDeprecated: boolean;
22
- /** The GraphQL entity kind (`objects`, `scalars`, `queries`, …) stamped by `formatter.ts`'s `formatMDXFrontmatter`. */
22
+ /** The GraphQL entity kind (`objects`, `scalars`, `queries`, …) stamped by `formatter.mjs`'s `formatMDXFrontmatter`. */
23
23
  kind?: string;
24
24
  }
25
25
 
@@ -63,7 +63,7 @@ export interface ApiSinglePageBucket {
63
63
  interface RawPage {
64
64
  path: string;
65
65
  title: string;
66
- /** Undeclared custom frontmatter, stamped by `formatter.ts`; Nuxt Content
66
+ /** Undeclared custom frontmatter, stamped by `formatter.mjs`; Nuxt Content
67
67
  * surfaces it under `meta`, not as a top-level field. */
68
68
  kind?: string;
69
69
  body: { [key: string]: unknown; value: MdcNode[] };
package/constants.ts ADDED
@@ -0,0 +1,2 @@
1
+ /** Default value for `gqlmd.baseURL` / `createGenerateDocs`'s `baseURL` option — the shared route prefix every page and content-generation call resolves against unless overridden. */
2
+ export const DEFAULT_BASE_URL = "api-reference";
@@ -1,39 +1,55 @@
1
+ // @ts-check
2
+
1
3
  /**
2
4
  * Formatter overrides handed to `graphql-markdown` (see `generate.ts`).
3
5
  *
4
- * The library loads this module by URL at generation time, so it is typed
6
+ * The library loads this module by URL with a native `import()` at
7
+ * generation time, and Node refuses to strip types from files under
8
+ * `node_modules` — so it ships as plain JS (typed via JSDoc), or every npm
9
+ * install would silently fall back to the default formatter. It is typed
5
10
  * structurally: `@graphql-markdown/types` is not a direct dependency, and its
6
11
  * `MDXString` return type is opaque and cannot be produced from here.
7
12
  */
8
13
 
9
- interface Badge {
10
- text: string;
11
- classname?: string[] | string;
12
- }
14
+ /**
15
+ * @typedef {object} Badge
16
+ * @property {string} text
17
+ * @property {string[] | string} [classname]
18
+ */
13
19
 
14
- interface Admonition {
15
- icon?: string | null;
16
- text: string;
17
- title: string | null;
18
- type: string;
19
- }
20
+ /**
21
+ * @typedef {object} Admonition
22
+ * @property {string | null} [icon]
23
+ * @property {string} text
24
+ * @property {string | null} title
25
+ * @property {string} type
26
+ */
20
27
 
21
- /** ` · ` instead of the default ` ● `, as text rather than a styled span. */
22
- export const formatMDXBullet = (text = ""): string => {
28
+ /**
29
+ * ` · ` instead of the default ` ● `, as text rather than a styled span.
30
+ *
31
+ * @param {string} [text]
32
+ * @returns {string}
33
+ */
34
+ export const formatMDXBullet = (text = "") => {
23
35
  return ` · ${text}`;
24
36
  };
25
37
 
26
- export const formatMDXBadge = ({ text }: Badge): string => {
38
+ /**
39
+ * @param {Badge} badge
40
+ * @returns {string}
41
+ */
42
+ export const formatMDXBadge = ({ text }) => {
27
43
  const suffix = String(text).toLowerCase();
28
44
 
29
45
  return `<mark class="gqlmd-mdx-badge gqlmd-mdx-badge-${suffix}">${text}</mark>`;
30
46
  };
31
47
 
32
- export const formatMDXAdmonition = ({
33
- text,
34
- title,
35
- type,
36
- }: Admonition): string => {
48
+ /**
49
+ * @param {Admonition} admonition
50
+ * @returns {string}
51
+ */
52
+ export const formatMDXAdmonition = ({ text, title, type }) => {
37
53
  if (
38
54
  type.toLowerCase() === "warning" &&
39
55
  title?.toLowerCase() === "deprecated"
@@ -63,12 +79,13 @@ export const mdxExtension = ".md";
63
79
  * grid by entity kind whenever a page has no folder segments left to group
64
80
  * by — today, that's `printTypeOptions.hierarchy: "flat"`, which otherwise
65
81
  * has nothing else to group on.
82
+ *
83
+ * @param {unknown} _props
84
+ * @param {string[] | null | undefined} formatted
85
+ * @param {{ entity?: string | null }} [context]
86
+ * @returns {string}
66
87
  */
67
- export const formatMDXFrontmatter = (
68
- _props: unknown,
69
- formatted: string[] | null | undefined,
70
- context?: { entity?: string | null },
71
- ): string => {
88
+ export const formatMDXFrontmatter = (_props, formatted, context) => {
72
89
  if (!formatted) return "";
73
90
  const lines = context?.entity
74
91
  ? [...formatted, `kind: ${context.entity}`]
package/generate.ts CHANGED
@@ -28,7 +28,7 @@ const DEFAULT_LOADERS = {
28
28
  * - baseURL: Base URL for the API reference (default: "api-reference")
29
29
  * - printTypeOptions: Formatting options merged with defaults
30
30
  * - decorators: Custom decorators for the schema output
31
- * - formatter: Path/URL to custom formatter module (default: this package's formatter.ts)
31
+ * - formatter: Path/URL to custom formatter module (default: this package's formatter.mjs)
32
32
  * - loaders: Custom schema loaders (default: GraphQLFileLoader)
33
33
  * @returns A function that generates the documentation when called
34
34
  */
@@ -47,7 +47,7 @@ export const createGenerateDocs = (userOptions: {
47
47
  baseURL = DEFAULT_BASE_URL,
48
48
  printTypeOptions,
49
49
  decorators,
50
- formatter = new URL("./formatter.ts", import.meta.url).href,
50
+ formatter = new URL("./formatter.mjs", import.meta.url).href,
51
51
  loaders = DEFAULT_LOADERS,
52
52
  } = userOptions;
53
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-markdown/nuxt-theme",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "A Nuxt layer for building GraphQL API reference sites",
5
5
  "homepage": "https://graphql-markdown.dev",
6
6
  "bugs": {
@@ -34,10 +34,10 @@
34
34
  },
35
35
  "scripts": {
36
36
  "build": "echo \"no build step — Nuxt layer ships source\"",
37
- "lint": "eslint --config ../../packages/tooling-config/eslint/config.ts \"app/**/*.{ts,vue}\" \"modules/**/*.ts\" \"*.ts\" \"bin/**/*.mjs\" \"tests/**/*.ts\" --ignore-pattern \"tests/fixture*/**\"",
38
- "lint:fix": "eslint --config ../../packages/tooling-config/eslint/config.ts \"app/**/*.{ts,vue}\" \"modules/**/*.ts\" \"*.ts\" \"bin/**/*.mjs\" \"tests/**/*.ts\" --ignore-pattern \"tests/fixture*/**\" --fix",
39
- "prettier": "prettier \"app/**/*.{ts,vue,css}\" \"modules/**/*.ts\" \"*.ts\" \"bin/**/*.mjs\" \"tests/**/*.ts\" \"!tests/fixture*/**\" --check",
40
- "prettier:fix": "prettier \"app/**/*.{ts,vue,css}\" \"modules/**/*.ts\" \"*.ts\" \"bin/**/*.mjs\" \"tests/**/*.ts\" \"!tests/fixture*/**\" --write",
37
+ "lint": "eslint --config ../../packages/tooling-config/eslint/config.ts \"app/**/*.{ts,vue}\" \"modules/**/*.ts\" \"*.ts\" \"*.mjs\" \"bin/**/*.mjs\" \"tests/**/*.ts\" --ignore-pattern \"tests/fixture*/**\"",
38
+ "lint:fix": "eslint --config ../../packages/tooling-config/eslint/config.ts \"app/**/*.{ts,vue}\" \"modules/**/*.ts\" \"*.ts\" \"*.mjs\" \"bin/**/*.mjs\" \"tests/**/*.ts\" --ignore-pattern \"tests/fixture*/**\" --fix",
39
+ "prettier": "prettier \"app/**/*.{ts,vue,css}\" \"modules/**/*.ts\" \"*.ts\" \"*.mjs\" \"bin/**/*.mjs\" \"tests/**/*.ts\" \"!tests/fixture*/**\" --check",
40
+ "prettier:fix": "prettier \"app/**/*.{ts,vue,css}\" \"modules/**/*.ts\" \"*.ts\" \"*.mjs\" \"bin/**/*.mjs\" \"tests/**/*.ts\" \"!tests/fixture*/**\" --write",
41
41
  "ts:check": "nuxi typecheck",
42
42
  "test": "vitest run --passWithNoTests",
43
43
  "test:unit": "vitest run --passWithNoTests tests/unit",
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@clack/prompts": "^1.0.0",
49
- "@graphql-markdown/cli": "",
49
+ "@graphql-markdown/cli": "^1.1.2",
50
50
  "@nuxt/content": "^3.16.0",
51
51
  "@nuxt/kit": "^4.5.2",
52
52
  "@nuxt/ui": "^4.11.0",
@@ -55,9 +55,10 @@
55
55
  "tailwindcss": "^4.3.3"
56
56
  },
57
57
  "devDependencies": {
58
- "@graphql-markdown/tooling-config": "",
58
+ "@graphql-markdown/tooling-config": "^1.0.0",
59
59
  "nuxt": "^4.5.2",
60
60
  "typescript": "6.0.3",
61
+ "vue-router": "^5.3.1",
61
62
  "vue-tsc": "^3.3.11"
62
63
  },
63
64
  "engines": {
@@ -73,8 +74,9 @@
73
74
  "app",
74
75
  "modules",
75
76
  "bin",
77
+ "constants.ts",
76
78
  "content.config.ts",
77
- "formatter.ts",
79
+ "formatter.mjs",
78
80
  "generate.ts",
79
81
  "nuxt.config.ts",
80
82
  "swizzle.manifest.ts",