nimbus-docs 0.1.8 → 0.1.10
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/cli/index.js +46 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/client.d.ts +12 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +38 -6
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +93 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1379 -25
- package/dist/index.js.map +1 -1
- package/dist/{rules-B7o0k3TA.js → rules-DDDvKkyJ.js} +2 -1
- package/dist/{rules-B7o0k3TA.js.map → rules-DDDvKkyJ.js.map} +1 -1
- package/package.json +9 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules-B7o0k3TA.js","names":["point","ok","isUint8Array","isPlainObj","parseYaml","jsxNameRe","htmlRe","jsxNameRe","jsxNameRe","inferProjectRoot","readExtraComponents","collectDefinitions","isExternal","matchesAnyIgnore","readJsxStringAttr","remarkLintNoMultipleTopLevelHeadings"],"sources":["../src/lint/diagnostic.ts","../src/lint/config.ts","../../../node_modules/.pnpm/mdast-util-to-string@4.0.0/node_modules/mdast-util-to-string/lib/index.js","../../../node_modules/.pnpm/micromark-util-character@2.1.1/node_modules/micromark-util-character/index.js","../../../node_modules/.pnpm/trough@2.2.0/node_modules/trough/lib/index.js","../../../node_modules/.pnpm/unified-lint-rule@3.0.1/node_modules/unified-lint-rule/lib/index.js","../../../node_modules/.pnpm/unist-util-position@5.0.0/node_modules/unist-util-position/lib/index.js","../../../node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.js","../../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/color.node.js","../../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/index.js","../../../node_modules/.pnpm/remark-lint-no-literal-urls@4.0.1/node_modules/remark-lint-no-literal-urls/index.js","../../../node_modules/.pnpm/bail@2.0.2/node_modules/bail/index.js","../../../node_modules/.pnpm/extend@3.0.2/node_modules/extend/index.js","../../../node_modules/.pnpm/devlop@1.1.0/node_modules/devlop/lib/default.js","../../../node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.js","../../../node_modules/.pnpm/unist-util-stringify-position@4.0.0/node_modules/unist-util-stringify-position/lib/index.js","../../../node_modules/.pnpm/vfile-message@4.0.3/node_modules/vfile-message/lib/index.js","../../../node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/minurl.shared.js","../../../node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/index.js","../../../node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/callable-instance.js","../../../node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.js","../src/lint/remark-lint-adapter.ts","../src/lint/rules/bare-url.ts","../../../node_modules/.pnpm/quotation@2.0.3/node_modules/quotation/index.js","../../../node_modules/.pnpm/mdast-util-phrasing@4.1.0/node_modules/mdast-util-phrasing/lib/index.js","../../../node_modules/.pnpm/remark-lint-fenced-code-flag@4.2.0/node_modules/remark-lint-fenced-code-flag/index.js","../src/lint/rules/code-block-lang.ts","../src/lint/parse.ts","../src/lint/rules/code-block-prompt-prefix.ts","../src/lint/rules/description-required.ts","../../../node_modules/.pnpm/remark-lint-no-duplicate-headings@4.0.1/node_modules/remark-lint-no-duplicate-headings/index.js","../src/lint/rules/duplicate-heading-text.ts","../../../node_modules/.pnpm/remark-lint-emphasis-marker@4.0.1/node_modules/remark-lint-emphasis-marker/index.js","../src/lint/rules/emphasis-style.ts","../src/lint/zod-adapter.ts","../src/lint/rules/frontmatter-shape.ts","../../../node_modules/.pnpm/remark-lint-heading-increment@4.0.1/node_modules/remark-lint-heading-increment/index.js","../src/lint/rules/heading-hierarchy.ts","../../../node_modules/.pnpm/remark-lint-no-heading-punctuation@4.0.1/node_modules/remark-lint-no-heading-punctuation/index.js","../src/lint/rules/heading-punctuation.ts","../src/_internal/levenshtein.ts","../src/lint/rules/image-ref.ts","../src/lint/rules/internal-link.ts","../../../node_modules/.pnpm/remark-lint-unordered-list-marker-style@4.0.1/node_modules/remark-lint-unordered-list-marker-style/index.js","../src/lint/rules/list-marker-style.ts","../src/lint/rules/no-self-host-url.ts","../../../node_modules/.pnpm/remark-lint-no-multiple-toplevel-headings@4.0.1/node_modules/remark-lint-no-multiple-toplevel-headings/index.js","../src/lint/rules/single-h1.ts","../src/lint/rules/index.ts"],"sourcesContent":["/**\n * The diagnostic envelope — the single shape every Nimbus check flows\n * through, from build validators to authoring rules to (eventually) Vale.\n *\n * Locked in Phase 0. Extending it later is a versioned schema bump, not a\n * field tacked on in a minor — see the cross-phase invariants in the\n * authoring-lints plan. Positions are the unist `Point` Sätteri's parser\n * already emits (1-based line/column plus a character offset), so a\n * diagnostic, a `--fix` edit range, and the pretty formatter's caret all\n * read from the one AST the renderer built.\n */\n\n/**\n * The stable rule-code registry. Every code Nimbus can emit lives here,\n * tagged with the tier it belongs to:\n *\n * - `build` — a build validator. Always on, fails `astro build`, no\n * severity knob. Cannot appear in the `rules` config.\n * - `authoring`— an authoring rule. Defaults to `error`, configurable to\n * `warn` / `off`, surfaced by `nimbus-docs lint`.\n *\n * Codes are registered here even before their rule is implemented so the\n * namespace is stable and `RuleCode` stays exhaustive: importing or\n * configuring an unknown code is a typecheck failure, not a silent no-op.\n */\nexport const RULE_CODES = {\n // Build validators — won't render → fail the build.\n \"nimbus/mdx-syntax\": { kind: \"build\" },\n \"nimbus/component-pascalcase\": { kind: \"build\" },\n \"nimbus/partial-exists\": { kind: \"build\" },\n \"nimbus/duplicate-slug\": { kind: \"build\" },\n\n // Authoring rules — renders fine, shouldn't ship.\n \"nimbus/frontmatter-shape\": { kind: \"authoring\" },\n \"nimbus/description-required\": { kind: \"authoring\" },\n \"nimbus/internal-link\": { kind: \"authoring\" },\n \"nimbus/image-ref\": { kind: \"authoring\" },\n \"nimbus/orphan-page\": { kind: \"authoring\" },\n \"nimbus/sidebar-entry\": { kind: \"authoring\" },\n \"nimbus/single-h1\": { kind: \"authoring\" },\n \"nimbus/heading-hierarchy\": { kind: \"authoring\" },\n \"nimbus/code-block-lang\": { kind: \"authoring\" },\n \"nimbus/code-block-prompt-prefix\": { kind: \"authoring\" },\n \"nimbus/no-self-host-url\": { kind: \"authoring\" },\n \"nimbus/heading-punctuation\": { kind: \"authoring\" },\n \"nimbus/duplicate-heading-text\": { kind: \"authoring\" },\n \"nimbus/list-marker-style\": { kind: \"authoring\" },\n \"nimbus/emphasis-style\": { kind: \"authoring\" },\n \"nimbus/bare-url\": { kind: \"authoring\" },\n} as const satisfies Record<string, { kind: \"build\" | \"authoring\" }>;\n\n/** Every rule code Nimbus knows about. */\nexport type RuleCode = keyof typeof RULE_CODES;\n\n/**\n * Authoring-rule codes only — the subset that's user-configurable via\n * `rules: { ... }`. Build validators are excluded at the type level so\n * TS-using consumers can't write the invalid config the runtime would\n * throw on, and so autocomplete inside `astro.config.ts` never offers\n * `nimbus/mdx-syntax` and friends.\n */\nexport type AuthoringRuleCode = {\n [K in RuleCode]: (typeof RULE_CODES)[K] extends { kind: \"authoring\" }\n ? K\n : never;\n}[RuleCode];\n\n/** Resolved severity — a rule that resolved to `off` never runs, so it\n * never reaches a `Diagnostic`. */\nexport type Severity = \"error\" | \"warn\";\n\n/** Severity as a user configures it. `off` disables the rule entirely. */\nexport type SeverityConfig = Severity | \"off\";\n\nexport interface DiagnosticFix {\n /** Human/agent-readable description of what the fix does. */\n description: string;\n /**\n * Edits to apply, as `[start, end]` character offsets into the source\n * (unist offsets — the same the AST reports), with replacement text.\n */\n edits: Array<{ range: [number, number]; text: string }>;\n}\n\nexport interface Diagnostic {\n code: RuleCode;\n severity: Severity;\n /** Which tool produced this. Reserved so Phase 4 can merge Vale into the\n * same envelope without a breaking change. */\n source: \"docs-compiler\" | \"vale\";\n message: string;\n /** Path relative to the project root. */\n file: string;\n /** 1-based, from the Sätteri AST. */\n line: number;\n /** 1-based, from the Sätteri AST. */\n column: number;\n endLine?: number;\n endColumn?: number;\n fix?: DiagnosticFix;\n}\n\n/** True when `code` is a build validator (unconfigurable, build-failing). */\nexport function isBuildValidator(code: RuleCode): boolean {\n return RULE_CODES[code].kind === \"build\";\n}\n\n/** Every known authoring-rule code. */\nexport function authoringRuleCodes(): RuleCode[] {\n return (Object.keys(RULE_CODES) as RuleCode[]).filter(\n (c) => RULE_CODES[c].kind === \"authoring\",\n );\n}\n\n/** Type guard: is `value` a registered rule code? */\nexport function isRuleCode(value: string): value is RuleCode {\n return Object.prototype.hasOwnProperty.call(RULE_CODES, value);\n}\n","/**\n * Lint configuration: the user-facing `rules` shape, severity resolution\n * for the engine, and the integration-side validator that enforces the\n * build/lint split at config time.\n *\n * The build / lint split is enforced here, not by convention: setting a\n * severity on a build validator, or using the reserved `collections` key,\n * is a typed, message-bearing failure — never a silent no-op.\n */\n\nimport {\n RULE_CODES,\n authoringRuleCodes,\n isBuildValidator,\n isRuleCode,\n type AuthoringRuleCode,\n type RuleCode,\n type SeverityConfig,\n} from \"./diagnostic.js\";\n\n/** A single rule's config: a bare severity, or `[severity, options]`. */\nexport type RuleSetting =\n | SeverityConfig\n | [SeverityConfig, Record<string, unknown>];\n\n/**\n * The `rules` option: authoring code → setting. Build validators don't appear\n * here — they have no severity knob (the runtime validator throws on misuse,\n * the type prevents the misuse from being writable in the first place).\n */\nexport type RulesConfig = Partial<Record<AuthoringRuleCode, RuleSetting>>;\n\n/** Per-collection lint config — currently just `rules` overrides. */\nexport interface CollectionLintConfig {\n rules?: RulesConfig;\n}\n\n/**\n * The `collections` option: collection name → per-collection overrides.\n * Each entry's `rules` shallow-merges over the top-level `rules` for\n * files in that collection. Per-rule resolution precedence is:\n * top-level defaults → per-collection → per-file `nimbusDisableRules`\n * → per-line inline disable. Each layer narrows scope.\n */\nexport type CollectionsConfig = Record<string, CollectionLintConfig>;\n\nexport interface ResolvedRule {\n severity: SeverityConfig;\n options: Record<string, unknown>;\n}\n\n/**\n * Default for an authoring rule with no explicit config: **off**. Nimbus\n * is opt-in by design — `rules: {}` means \"no authoring rules run\"; the\n * project enables what it wants. The scaffolded starter ships with\n * `nimbus/frontmatter-shape` and `nimbus/internal-link` turned on in its\n * `astro.config.ts`, visible and editable.\n *\n * The `--rule=<code>` CLI flag overrides this for the targeted rule (see\n * `engine.ts`) — otherwise running the CLI to inspect an off-by-default\n * rule would silently print nothing.\n */\nconst DEFAULT_AUTHORING_SEVERITY: SeverityConfig = \"off\";\n\n/** Resolve the effective severity + options for an authoring rule. */\nexport function resolveRule(code: AuthoringRuleCode, rules: RulesConfig): ResolvedRule {\n const setting = rules[code];\n if (setting === undefined) {\n return { severity: DEFAULT_AUTHORING_SEVERITY, options: {} };\n }\n if (Array.isArray(setting)) {\n return { severity: setting[0], options: setting[1] ?? {} };\n }\n return { severity: setting, options: {} };\n}\n\n/**\n * Resolve a rule with an optional per-collection override layer.\n * Shallow-merges per rule code — a collection-level setting fully\n * replaces the top-level one for that code, options included (we don't\n * deep-merge option bags, since a partial override would silently drop\n * defaults the user can't see). The caller passes `collection` from\n * `file.collection`; when null or unconfigured, behaves like\n * `resolveRule` over just the top-level config.\n */\nexport function resolveRuleForCollection(\n code: AuthoringRuleCode,\n rules: RulesConfig,\n collections: CollectionsConfig,\n collection: string | null,\n): ResolvedRule {\n const collectionRules =\n (collection !== null && collections[collection]?.rules) || undefined;\n if (collectionRules && code in collectionRules) {\n return resolveRule(code, collectionRules);\n }\n return resolveRule(code, rules);\n}\n\nexport interface ValidatedLintOptions {\n rules: RulesConfig;\n collections: CollectionsConfig;\n}\n\n/**\n * Validate the lint half of the integration options\n * (`nimbus(config, { rules, collections })`). Throws a content-author\n * readable error on the first structural problem. Returns the normalized\n * `rules` config on success.\n *\n * When `implementedCodes` is supplied, also fails on authoring rules that\n * are registered in `RULE_CODES` but not yet wired to a rule module —\n * configuring a non-existent rule is a footgun (silent no-op) that should\n * surface as a typed error, not be discovered later when the rule never\n * fires. The caller (the integration) passes `IMPLEMENTED_CODES` here;\n * standalone callers (the CLI's own materialized-config loader, tests\n * exercising shape validation) may omit it.\n */\nexport function validateLintOptions(input: {\n rules?: unknown;\n collections?: unknown;\n}, implementedCodes?: ReadonlySet<RuleCode>): ValidatedLintOptions {\n const rules = validateRulesBlock(input.rules, \"rules\", implementedCodes);\n const collections = validateCollectionsBlock(\n input.collections,\n implementedCodes,\n );\n return { rules, collections };\n}\n\n/**\n * Validate a `rules` block — used both for the top-level `rules` option\n * and the per-collection `collections.<name>.rules` block. `where`\n * identifies the block in error messages so the user knows which one to\n * fix (e.g. `rules` vs `collections.docs.rules`).\n */\nfunction validateRulesBlock(\n rawRules: unknown,\n where: string,\n implementedCodes: ReadonlySet<RuleCode> | undefined,\n): RulesConfig {\n if (rawRules === undefined) return {};\n if (typeof rawRules !== \"object\" || rawRules === null || Array.isArray(rawRules)) {\n throw new Error(\n `nimbus-docs: \\`${where}\\` must be an object mapping rule codes to a severity (\"error\" | \"warn\" | \"off\") or a [severity, options] tuple.`,\n );\n }\n\n const rules = rawRules as Record<string, unknown>;\n for (const [code, setting] of Object.entries(rules)) {\n if (!isRuleCode(code)) {\n throw new Error(\n `nimbus-docs: unknown rule code \"${code}\" in \\`${where}\\`. ` +\n `Valid authoring rules: ${authoringRuleCodes().join(\", \")}.`,\n );\n }\n if (isBuildValidator(code)) {\n throw new Error(\n `nimbus-docs: \"${code}\" is a build validator — it has no severity knob and can't appear in \\`${where}\\`. ` +\n \"It either passes or the build fails. To skip it on a specific file, use a per-file `nimbusDisableRules` entry or an inline disable comment instead.\",\n );\n }\n const severity = Array.isArray(setting) ? setting[0] : setting;\n if (severity !== \"error\" && severity !== \"warn\" && severity !== \"off\") {\n throw new Error(\n `nimbus-docs: \"${code}\" in \\`${where}\\` has an invalid severity ${JSON.stringify(severity)}. Use \"error\", \"warn\", or \"off\"` +\n ' (optionally as a tuple: [\"error\", { /* options */ }]).',\n );\n }\n if (Array.isArray(setting) && setting[1] !== undefined &&\n (typeof setting[1] !== \"object\" || setting[1] === null)) {\n throw new Error(\n `nimbus-docs: the options half of the tuple for \"${code}\" in \\`${where}\\` must be an object, e.g. [\"error\", { allow: [\"mermaid\"] }].`,\n );\n }\n if (implementedCodes && !implementedCodes.has(code) && severity !== \"off\") {\n throw new Error(\n `nimbus-docs: \"${code}\" is registered but not yet implemented — configuring it as \"${severity}\" in \\`${where}\\` would silently do nothing. ` +\n \"Remove the entry, or set it to \\\"off\\\" to silence the warning if you're forward-configuring for a future release.\",\n );\n }\n }\n return rules as RulesConfig;\n}\n\n/**\n * Validate the `collections` block. Each value is a `{ rules?: ... }`\n * object whose `rules` follow the same shape as the top-level `rules`\n * option — including the build-validator carve-out (build validators\n * stay global; they can't be configured per-collection).\n */\nfunction validateCollectionsBlock(\n rawCollections: unknown,\n implementedCodes: ReadonlySet<RuleCode> | undefined,\n): CollectionsConfig {\n if (rawCollections === undefined) return {};\n if (\n typeof rawCollections !== \"object\" ||\n rawCollections === null ||\n Array.isArray(rawCollections)\n ) {\n throw new Error(\n 'nimbus-docs: `collections` must be an object mapping collection names to a `{ rules: {…} }` block.',\n );\n }\n const out: CollectionsConfig = {};\n for (const [name, raw] of Object.entries(\n rawCollections as Record<string, unknown>,\n )) {\n if (typeof raw !== \"object\" || raw === null || Array.isArray(raw)) {\n throw new Error(\n `nimbus-docs: \\`collections.${name}\\` must be an object, e.g. \\`{ rules: { \"nimbus/single-h1\": \"off\" } }\\`.`,\n );\n }\n const block = raw as { rules?: unknown };\n const rules = validateRulesBlock(\n block.rules,\n `collections.${name}.rules`,\n implementedCodes,\n );\n out[name] = { rules };\n }\n return out;\n}\n\n/** Codes registered but not yet wired to a rule implementation. Used by the\n * CLI to avoid silently claiming coverage it doesn't have. */\nexport function isImplemented(code: RuleCode, implemented: ReadonlySet<RuleCode>): boolean {\n return implemented.has(code) && code in RULE_CODES;\n}\n","/**\n * @typedef {import('mdast').Nodes} Nodes\n *\n * @typedef Options\n * Configuration (optional).\n * @property {boolean | null | undefined} [includeImageAlt=true]\n * Whether to use `alt` for `image`s (default: `true`).\n * @property {boolean | null | undefined} [includeHtml=true]\n * Whether to use `value` of HTML (default: `true`).\n */\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Get the text content of a node or list of nodes.\n *\n * Prefers the node’s plain-text fields, otherwise serializes its children,\n * and if the given value is an array, serialize the nodes in it.\n *\n * @param {unknown} [value]\n * Thing to serialize, typically `Node`.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {string}\n * Serialized `value`.\n */\nexport function toString(value, options) {\n const settings = options || emptyOptions\n const includeImageAlt =\n typeof settings.includeImageAlt === 'boolean'\n ? settings.includeImageAlt\n : true\n const includeHtml =\n typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true\n\n return one(value, includeImageAlt, includeHtml)\n}\n\n/**\n * One node or several nodes.\n *\n * @param {unknown} value\n * Thing to serialize.\n * @param {boolean} includeImageAlt\n * Include image `alt`s.\n * @param {boolean} includeHtml\n * Include HTML.\n * @returns {string}\n * Serialized node.\n */\nfunction one(value, includeImageAlt, includeHtml) {\n if (node(value)) {\n if ('value' in value) {\n return value.type === 'html' && !includeHtml ? '' : value.value\n }\n\n if (includeImageAlt && 'alt' in value && value.alt) {\n return value.alt\n }\n\n if ('children' in value) {\n return all(value.children, includeImageAlt, includeHtml)\n }\n }\n\n if (Array.isArray(value)) {\n return all(value, includeImageAlt, includeHtml)\n }\n\n return ''\n}\n\n/**\n * Serialize a list of nodes.\n *\n * @param {Array<unknown>} values\n * Thing to serialize.\n * @param {boolean} includeImageAlt\n * Include image `alt`s.\n * @param {boolean} includeHtml\n * Include HTML.\n * @returns {string}\n * Serialized nodes.\n */\nfunction all(values, includeImageAlt, includeHtml) {\n /** @type {Array<string>} */\n const result = []\n let index = -1\n\n while (++index < values.length) {\n result[index] = one(values[index], includeImageAlt, includeHtml)\n }\n\n return result.join('')\n}\n\n/**\n * Check if `value` looks like a node.\n *\n * @param {unknown} value\n * Thing.\n * @returns {value is Nodes}\n * Whether `value` is a node.\n */\nfunction node(value) {\n return Boolean(value && typeof value === 'object')\n}\n","/**\n * @import {Code} from 'micromark-util-types'\n */\n\n/**\n * Check whether the character code represents an ASCII alpha (`a` through `z`,\n * case insensitive).\n *\n * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha.\n *\n * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`)\n * to U+005A (`Z`).\n *\n * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`)\n * to U+007A (`z`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiAlpha = regexCheck(/[A-Za-z]/);\n\n/**\n * Check whether the character code represents an ASCII alphanumeric (`a`\n * through `z`, case insensitive, or `0` through `9`).\n *\n * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha\n * (see `asciiAlpha`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiAlphanumeric = regexCheck(/[\\dA-Za-z]/);\n\n/**\n * Check whether the character code represents an ASCII atext.\n *\n * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in\n * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`),\n * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F\n * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E\n * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE\n * (`{`) to U+007E TILDE (`~`).\n *\n * See:\n * **\\[RFC5322]**:\n * [Internet Message Format](https://tools.ietf.org/html/rfc5322).\n * P. Resnick.\n * IETF.\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiAtext = regexCheck(/[#-'*+\\--9=?A-Z^-~]/);\n\n/**\n * Check whether a character code is an ASCII control character.\n *\n * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL)\n * to U+001F (US), or U+007F (DEL).\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport function asciiControl(code) {\n return (\n // Special whitespace codes (which have negative values), C0 and Control\n // character DEL\n code !== null && (code < 32 || code === 127)\n );\n}\n\n/**\n * Check whether the character code represents an ASCII digit (`0` through `9`).\n *\n * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to\n * U+0039 (`9`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiDigit = regexCheck(/\\d/);\n\n/**\n * Check whether the character code represents an ASCII hex digit (`a` through\n * `f`, case insensitive, or `0` through `9`).\n *\n * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex\n * digit, or an ASCII lower hex digit.\n *\n * An **ASCII upper hex digit** is a character in the inclusive range U+0041\n * (`A`) to U+0046 (`F`).\n *\n * An **ASCII lower hex digit** is a character in the inclusive range U+0061\n * (`a`) to U+0066 (`f`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiHexDigit = regexCheck(/[\\dA-Fa-f]/);\n\n/**\n * Check whether the character code represents ASCII punctuation.\n *\n * An **ASCII punctuation** is a character in the inclusive ranges U+0021\n * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT\n * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT\n * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);\n\n/**\n * Check whether a character code is a markdown line ending.\n *\n * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN\n * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR).\n *\n * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE\n * RETURN (CR) are replaced by these virtual characters depending on whether\n * they occurred together.\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport function markdownLineEnding(code) {\n return code !== null && code < -2;\n}\n\n/**\n * Check whether a character code is a markdown line ending (see\n * `markdownLineEnding`) or markdown space (see `markdownSpace`).\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport function markdownLineEndingOrSpace(code) {\n return code !== null && (code < 0 || code === 32);\n}\n\n/**\n * Check whether a character code is a markdown space.\n *\n * A **markdown space** is the concrete character U+0020 SPACE (SP) and the\n * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT).\n *\n * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is\n * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL\n * SPACE (VS) characters, depending on the column at which the tab occurred.\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport function markdownSpace(code) {\n return code === -2 || code === -1 || code === 32;\n}\n\n// Size note: removing ASCII from the regex and using `asciiPunctuation` here\n// In fact adds to the bundle size.\n/**\n * Check whether the character code represents Unicode punctuation.\n *\n * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation,\n * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf`\n * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po`\n * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII\n * punctuation (see `asciiPunctuation`).\n *\n * See:\n * **\\[UNICODE]**:\n * [The Unicode Standard](https://www.unicode.org/versions/).\n * Unicode Consortium.\n *\n * @param code\n * Code.\n * @returns\n * Whether it matches.\n */\nexport const unicodePunctuation = regexCheck(/\\p{P}|\\p{S}/u);\n\n/**\n * Check whether the character code represents Unicode whitespace.\n *\n * Note that this does handle micromark specific markdown whitespace characters.\n * See `markdownLineEndingOrSpace` to check that.\n *\n * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator,\n * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF),\n * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\\[UNICODE]**).\n *\n * See:\n * **\\[UNICODE]**:\n * [The Unicode Standard](https://www.unicode.org/versions/).\n * Unicode Consortium.\n *\n * @param code\n * Code.\n * @returns\n * Whether it matches.\n */\nexport const unicodeWhitespace = regexCheck(/\\s/);\n\n/**\n * Create a code check from a regex.\n *\n * @param {RegExp} regex\n * Expression.\n * @returns {(code: Code) => boolean}\n * Check.\n */\nfunction regexCheck(regex) {\n return check;\n\n /**\n * Check whether a code matches the bound regex.\n *\n * @param {Code} code\n * Character code.\n * @returns {boolean}\n * Whether the character code matches the bound regex.\n */\n function check(code) {\n return code !== null && code > -1 && regex.test(String.fromCharCode(code));\n }\n}","// To do: remove `void`s\n// To do: remove `null` from output of our APIs, allow it as user APIs.\n\n/**\n * @typedef {(error?: Error | null | undefined, ...output: Array<any>) => void} Callback\n * Callback.\n *\n * @typedef {(...input: Array<any>) => any} Middleware\n * Ware.\n *\n * @typedef Pipeline\n * Pipeline.\n * @property {Run} run\n * Run the pipeline.\n * @property {Use} use\n * Add middleware.\n *\n * @typedef {(...input: Array<any>) => void} Run\n * Call all middleware.\n *\n * Calls `done` on completion with either an error or the output of the\n * last middleware.\n *\n * > 👉 **Note**: as the length of input defines whether async functions get a\n * > `next` function,\n * > it’s recommended to keep `input` at one value normally.\n\n *\n * @typedef {(fn: Middleware) => Pipeline} Use\n * Add middleware.\n */\n\n/**\n * Create new middleware.\n *\n * @returns {Pipeline}\n * Pipeline.\n */\nexport function trough() {\n /** @type {Array<Middleware>} */\n const fns = []\n /** @type {Pipeline} */\n const pipeline = {run, use}\n\n return pipeline\n\n /** @type {Run} */\n function run(...values) {\n let middlewareIndex = -1\n /** @type {Callback} */\n const callback = values.pop()\n\n if (typeof callback !== 'function') {\n throw new TypeError('Expected function as last argument, not ' + callback)\n }\n\n next(null, ...values)\n\n /**\n * Run the next `fn`, or we’re done.\n *\n * @param {Error | null | undefined} error\n * @param {Array<any>} output\n */\n function next(error, ...output) {\n const fn = fns[++middlewareIndex]\n let index = -1\n\n if (error) {\n callback(error)\n return\n }\n\n // Copy non-nullish input into values.\n while (++index < values.length) {\n if (output[index] === null || output[index] === undefined) {\n output[index] = values[index]\n }\n }\n\n // Save the newly created `output` for the next call.\n values = output\n\n // Next or done.\n if (fn) {\n wrap(fn, next)(...output)\n } else {\n callback(null, ...output)\n }\n }\n }\n\n /** @type {Use} */\n function use(middelware) {\n if (typeof middelware !== 'function') {\n throw new TypeError(\n 'Expected `middelware` to be a function, not ' + middelware\n )\n }\n\n fns.push(middelware)\n return pipeline\n }\n}\n\n/**\n * Wrap `middleware` into a uniform interface.\n *\n * You can pass all input to the resulting function.\n * `callback` is then called with the output of `middleware`.\n *\n * If `middleware` accepts more arguments than the later given in input,\n * an extra `done` function is passed to it after that input,\n * which must be called by `middleware`.\n *\n * The first value in `input` is the main input value.\n * All other input values are the rest input values.\n * The values given to `callback` are the input values,\n * merged with every non-nullish output value.\n *\n * * if `middleware` throws an error,\n * returns a promise that is rejected,\n * or calls the given `done` function with an error,\n * `callback` is called with that error\n * * if `middleware` returns a value or returns a promise that is resolved,\n * that value is the main output value\n * * if `middleware` calls `done`,\n * all non-nullish values except for the first one (the error) overwrite the\n * output values\n *\n * @param {Middleware} middleware\n * Function to wrap.\n * @param {Callback} callback\n * Callback called with the output of `middleware`.\n * @returns {Run}\n * Wrapped middleware.\n */\nexport function wrap(middleware, callback) {\n /** @type {boolean} */\n let called\n\n return wrapped\n\n /**\n * Call `middleware`.\n * @this {any}\n * @param {Array<any>} parameters\n * @returns {void}\n */\n function wrapped(...parameters) {\n const fnExpectsCallback = middleware.length > parameters.length\n /** @type {any} */\n let result\n\n if (fnExpectsCallback) {\n parameters.push(done)\n }\n\n try {\n result = middleware.apply(this, parameters)\n } catch (error) {\n const exception = /** @type {Error} */ (error)\n\n // Well, this is quite the pickle.\n // `middleware` received a callback and called it synchronously, but that\n // threw an error.\n // The only thing left to do is to throw the thing instead.\n if (fnExpectsCallback && called) {\n throw exception\n }\n\n return done(exception)\n }\n\n if (!fnExpectsCallback) {\n if (result && result.then && typeof result.then === 'function') {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n /**\n * Call `callback`, only once.\n *\n * @type {Callback}\n */\n function done(error, ...output) {\n if (!called) {\n called = true\n callback(error, ...output)\n }\n }\n\n /**\n * Call `done` with one value.\n *\n * @param {any} [value]\n */\n function then(value) {\n done(null, value)\n }\n}\n","/**\n * @import {TransformCallback} from 'unified'\n * @import {Plugin, Rule} from 'unified-lint-rule'\n * @import {Node} from 'unist'\n * @import {VFile} from 'vfile'\n */\n\n/**\n * @typedef {'error' | 'on' | 'off' | 'warn'} Label\n * Severity label;\n * `'off'`: `0`, `'on'` and `warn`: `1`, `'error'`: `2`.\n *\n * @typedef Meta\n * Rule metadata.\n * @property {string} origin\n * Name of the lint rule.\n * @property {string | null | undefined} [url]\n * Link to documentation (optional).\n *\n * @typedef {0 | 1 | 2} Severity\n * Severity number;\n * `0`: `'off'`, `1`: `'on'` and `warn`, `2`: `'error'`.\n */\n\nimport {wrap} from 'trough'\n\n/**\n * @template {Node} [Tree=Node]\n * Node kind.\n * @template {unknown} [Option=unknown]\n * Parameter kind.\n * @param {Meta | string} meta\n * Info.\n * @param {Rule<Tree, Option>} rule\n * Rule.\n * @returns {Plugin<Tree, Option>}\n * Plugin.\n */\nexport function lintRule(meta, rule) {\n const id = typeof meta === 'string' ? meta : meta.origin\n const url = typeof meta === 'string' ? undefined : meta.url\n const parts = id.split(':')\n /* c8 ignore next -- Possibly useful if externalised later. */\n const source = parts[1] ? parts[0] : undefined\n const ruleId = parts[1]\n\n Object.defineProperty(plugin, 'name', {value: id})\n\n return plugin\n\n /**\n * @param {[level: Label | Severity | boolean, option?: Option] | Label | Option | Severity} [config]\n * Config.\n * @returns\n * Transform, if on.\n */\n function plugin(config) {\n const [severity, options] = coerce(ruleId, config)\n\n const fatal = severity === 2\n\n if (!severity) return\n\n /**\n * @param {Tree} tree\n * Tree.\n * @param {VFile} file\n * File.\n * @param {TransformCallback<Tree>} next\n * Next.\n * @returns {undefined}\n * Nothing.\n */\n return function (tree, file, next) {\n let index = file.messages.length - 1\n\n wrap(rule, function (error) {\n const messages = file.messages\n\n /* c8 ignore next 8 -- add the error,\n * if not already properly added.\n * Only happens for incorrect plugins. */\n // @ts-expect-error: errors could be `messages`.\n if (error && !messages.includes(error)) {\n try {\n file.fail(error)\n } catch {}\n }\n\n while (++index < messages.length) {\n Object.assign(messages[index], {fatal, ruleId, source, url})\n }\n\n next()\n })(tree, file, options)\n }\n }\n}\n\n/**\n * Coerce a value to a severity--options tuple.\n *\n * @template {unknown} [Option=unknown]\n * Parameter kind.\n * @param {string} name\n * Rule name.\n * @param {[level: Label | Severity | boolean, option?: Option] | Option} config\n * Configuration.\n * @returns {[severity: Severity, parameter: Option | undefined]}\n * Severity and options.\n */\nfunction coerce(name, config) {\n if (Array.isArray(config)) {\n const [severity, option] = config\n\n switch (severity) {\n case false:\n case 0:\n case 'off': {\n return [0, option]\n }\n\n case true:\n case 1:\n case 'on':\n case 'warn': {\n return [1, option]\n }\n\n case 2:\n case 'error': {\n return [2, option]\n }\n\n default: {\n if (typeof severity === 'number') {\n throw new Error(\n 'Incorrect severity `' +\n severity +\n '` for `' +\n name +\n '`, ' +\n 'expected 0, 1, or 2'\n )\n }\n\n // If we do not know the 1st item of the array,\n // and it’s not a number,\n // assume `config` is *meant* as an array.\n return [1, /** @type {Option} */ (config)]\n }\n }\n }\n\n return [1, config]\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Point} Point\n * @typedef {import('unist').Position} Position\n */\n\n/**\n * @typedef NodeLike\n * @property {string} type\n * @property {PositionLike | null | undefined} [position]\n *\n * @typedef PositionLike\n * @property {PointLike | null | undefined} [start]\n * @property {PointLike | null | undefined} [end]\n *\n * @typedef PointLike\n * @property {number | null | undefined} [line]\n * @property {number | null | undefined} [column]\n * @property {number | null | undefined} [offset]\n */\n\n/**\n * Get the ending point of `node`.\n *\n * @param node\n * Node.\n * @returns\n * Point.\n */\nexport const pointEnd = point('end')\n\n/**\n * Get the starting point of `node`.\n *\n * @param node\n * Node.\n * @returns\n * Point.\n */\nexport const pointStart = point('start')\n\n/**\n * Get the positional info of `node`.\n *\n * @param {'end' | 'start'} type\n * Side.\n * @returns\n * Getter.\n */\nfunction point(type) {\n return point\n\n /**\n * Get the point info of `node` at a bound side.\n *\n * @param {Node | NodeLike | null | undefined} [node]\n * @returns {Point | undefined}\n */\n function point(node) {\n const point = (node && node.position && node.position[type]) || {}\n\n if (\n typeof point.line === 'number' &&\n point.line > 0 &&\n typeof point.column === 'number' &&\n point.column > 0\n ) {\n return {\n line: point.line,\n column: point.column,\n offset:\n typeof point.offset === 'number' && point.offset > -1\n ? point.offset\n : undefined\n }\n }\n }\n}\n\n/**\n * Get the positional info of `node`.\n *\n * @param {Node | NodeLike | null | undefined} [node]\n * Node.\n * @returns {Position | undefined}\n * Position.\n */\nexport function position(node) {\n const start = pointStart(node)\n const end = pointEnd(node)\n\n if (start && end) {\n return {start, end}\n }\n}\n","/**\n * @import {Node, Parent} from 'unist'\n */\n\n/**\n * @template Fn\n * @template Fallback\n * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate\n */\n\n/**\n * @callback Check\n * Check that an arbitrary value is a node.\n * @param {unknown} this\n * The given context.\n * @param {unknown} [node]\n * Anything (typically a node).\n * @param {number | null | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | null | undefined} [parent]\n * The node’s parent.\n * @returns {boolean}\n * Whether this is a node and passes a test.\n *\n * @typedef {Record<string, unknown> | Node} Props\n * Object to check for equivalence.\n *\n * Note: `Node` is included as it is common but is not indexable.\n *\n * @typedef {Array<Props | TestFunction | string> | ReadonlyArray<Props | TestFunction | string> | Props | TestFunction | string | null | undefined} Test\n * Check for an arbitrary node.\n *\n * @callback TestFunction\n * Check if a node passes a test.\n * @param {unknown} this\n * The given context.\n * @param {Node} node\n * A node.\n * @param {number | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | undefined} [parent]\n * The node’s parent.\n * @returns {boolean | undefined | void}\n * Whether this node passes the test.\n *\n * Note: `void` is included until TS sees no return as `undefined`.\n */\n\n/**\n * Check if `node` is a `Node` and whether it passes the given test.\n *\n * @param {unknown} node\n * Thing to check, typically `Node`.\n * @param {Test} test\n * A check for a specific node.\n * @param {number | null | undefined} index\n * The node’s position in its parent.\n * @param {Parent | null | undefined} parent\n * The node’s parent.\n * @param {unknown} context\n * Context object (`this`) to pass to `test` functions.\n * @returns {boolean}\n * Whether `node` is a node and passes a test.\n */\nexport const is =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * (<Condition extends ReadonlyArray<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &\n * (<Condition extends Array<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &\n * (<Condition extends string>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * (<Condition extends Props>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * (<Condition extends TestFunction>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &\n * ((node?: null | undefined) => false) &\n * ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean)\n * )}\n */\n (\n /**\n * @param {unknown} [node]\n * @param {Test} [test]\n * @param {number | null | undefined} [index]\n * @param {Parent | null | undefined} [parent]\n * @param {unknown} [context]\n * @returns {boolean}\n */\n // eslint-disable-next-line max-params\n function (node, test, index, parent, context) {\n const check = convert(test)\n\n if (\n index !== undefined &&\n index !== null &&\n (typeof index !== 'number' ||\n index < 0 ||\n index === Number.POSITIVE_INFINITY)\n ) {\n throw new Error('Expected positive finite index')\n }\n\n if (\n parent !== undefined &&\n parent !== null &&\n (!is(parent) || !parent.children)\n ) {\n throw new Error('Expected parent node')\n }\n\n if (\n (parent === undefined || parent === null) !==\n (index === undefined || index === null)\n ) {\n throw new Error('Expected both parent and index')\n }\n\n return looksLikeANode(node)\n ? check.call(context, node, index, parent)\n : false\n }\n )\n\n/**\n * Generate an assertion from a test.\n *\n * Useful if you’re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * a `node`, `index`, and `parent`.\n *\n * @param {Test} test\n * * when nullish, checks if `node` is a `Node`.\n * * when `string`, works like passing `(node) => node.type === test`.\n * * when `function` checks if function passed the node is true.\n * * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.\n * * when `array`, checks if any one of the subtests pass.\n * @returns {Check}\n * An assertion.\n */\nexport const convert =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &\n * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((test?: Test) => Check)\n * )}\n */\n (\n /**\n * @param {Test} [test]\n * @returns {Check}\n */\n function (test) {\n if (test === null || test === undefined) {\n return ok\n }\n\n if (typeof test === 'function') {\n return castFactory(test)\n }\n\n if (typeof test === 'object') {\n return Array.isArray(test)\n ? anyFactory(test)\n : // Cast because `ReadonlyArray` goes into the above but `isArray`\n // narrows to `Array`.\n propertiesFactory(/** @type {Props} */ (test))\n }\n\n if (typeof test === 'string') {\n return typeFactory(test)\n }\n\n throw new Error('Expected function, string, or object as test')\n }\n )\n\n/**\n * @param {Array<Props | TestFunction | string>} tests\n * @returns {Check}\n */\nfunction anyFactory(tests) {\n /** @type {Array<Check>} */\n const checks = []\n let index = -1\n\n while (++index < tests.length) {\n checks[index] = convert(tests[index])\n }\n\n return castFactory(any)\n\n /**\n * @this {unknown}\n * @type {TestFunction}\n */\n function any(...parameters) {\n let index = -1\n\n while (++index < checks.length) {\n if (checks[index].apply(this, parameters)) return true\n }\n\n return false\n }\n}\n\n/**\n * Turn an object into a test for a node with a certain fields.\n *\n * @param {Props} check\n * @returns {Check}\n */\nfunction propertiesFactory(check) {\n const checkAsRecord = /** @type {Record<string, unknown>} */ (check)\n\n return castFactory(all)\n\n /**\n * @param {Node} node\n * @returns {boolean}\n */\n function all(node) {\n const nodeAsRecord = /** @type {Record<string, unknown>} */ (\n /** @type {unknown} */ (node)\n )\n\n /** @type {string} */\n let key\n\n for (key in check) {\n if (nodeAsRecord[key] !== checkAsRecord[key]) return false\n }\n\n return true\n }\n}\n\n/**\n * Turn a string into a test for a node with a certain type.\n *\n * @param {string} check\n * @returns {Check}\n */\nfunction typeFactory(check) {\n return castFactory(type)\n\n /**\n * @param {Node} node\n */\n function type(node) {\n return node && node.type === check\n }\n}\n\n/**\n * Turn a custom test into a test for a node that passes that test.\n *\n * @param {TestFunction} testFunction\n * @returns {Check}\n */\nfunction castFactory(testFunction) {\n return check\n\n /**\n * @this {unknown}\n * @type {Check}\n */\n function check(value, index, parent) {\n return Boolean(\n looksLikeANode(value) &&\n testFunction.call(\n this,\n value,\n typeof index === 'number' ? index : undefined,\n parent || undefined\n )\n )\n }\n}\n\nfunction ok() {\n return true\n}\n\n/**\n * @param {unknown} value\n * @returns {value is Node}\n */\nfunction looksLikeANode(value) {\n return value !== null && typeof value === 'object' && 'type' in value\n}\n","/**\n * @param {string} d\n * @returns {string}\n */\nexport function color(d) {\n return '\\u001B[33m' + d + '\\u001B[39m'\n}\n","/**\n * @import {Node as UnistNode, Parent as UnistParent} from 'unist'\n */\n\n/**\n * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test\n * Test from `unist-util-is`.\n *\n * Note: we have remove and add `undefined`, because otherwise when generating\n * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n * which doesn’t work when publishing on npm.\n */\n\n/**\n * @typedef {(\n * Fn extends (value: any) => value is infer Thing\n * ? Thing\n * : Fallback\n * )} Predicate\n * Get the value of a type guard `Fn`.\n * @template Fn\n * Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n * Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n * Check extends null | undefined // No test.\n * ? Value\n * : Value extends {type: Check} // String (type) test.\n * ? Value\n * : Value extends Check // Partial test.\n * ? Value\n * : Check extends Function // Function test.\n * ? Predicate<Check, Value> extends Value\n * ? Predicate<Check, Value>\n * : never\n * : never // Some other test?\n * )} MatchesOne\n * Check whether a node matches a primitive check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n * Check extends ReadonlyArray<infer T>\n * ? MatchesOne<Value, T>\n * : Check extends Array<infer T>\n * ? MatchesOne<Value, T>\n * : MatchesOne<Value, Check>\n * )} Matches\n * Check whether a node matches a check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n * Number; capped reasonably.\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n * Increment a number in the type system.\n * @template {Uint} [I=0]\n * Index.\n */\n\n/**\n * @typedef {(\n * Node extends UnistParent\n * ? Node extends {children: Array<infer Children>}\n * ? Child extends Children ? Node : never\n * : never\n * : never\n * )} InternalParent\n * Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {InternalParent<InclusiveDescendant<Tree>, Child>} Parent\n * Collect nodes in `Tree` that can be parents of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Depth extends Max\n * ? never\n * :\n * | InternalParent<Node, Child>\n * | InternalAncestor<Node, InternalParent<Node, Child>, Max, Increment<Depth>>\n * )} InternalAncestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {InternalAncestor<InclusiveDescendant<Tree>, Child>} Ancestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Tree extends UnistParent\n * ? Depth extends Max\n * ? Tree\n * : Tree | InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>\n * : Tree\n * )} InclusiveDescendant\n * Collect all (inclusive) descendants of `Tree`.\n *\n * > 👉 **Note**: for performance reasons, this seems to be the fastest way to\n * > recurse without actually running into an infinite loop, which the\n * > previous version did.\n * >\n * > Practically, a max of `2` is typically enough assuming a `Root` is\n * > passed, but it doesn’t improve performance.\n * > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n * > Using up to `10` doesn’t hurt or help either.\n * @template {UnistNode} Tree\n * Tree type.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {'skip' | boolean} Action\n * Union of the action types.\n *\n * @typedef {number} Index\n * Move to the sibling at `index` next (after node itself is completely\n * traversed).\n *\n * Useful if mutating the tree, such as removing the node the visitor is\n * currently on, or any of its previous siblings.\n * Results less than 0 or greater than or equal to `children.length` stop\n * traversing the parent.\n *\n * @typedef {[(Action | null | undefined | void)?, (Index | null | undefined)?]} ActionTuple\n * List with one or two values, the first an action, the second an index.\n *\n * @typedef {Action | ActionTuple | Index | null | undefined | void} VisitorResult\n * Any value that can be returned from a visitor.\n */\n\n/**\n * @callback Visitor\n * Handle a node (matching `test`, if given).\n *\n * Visitors are free to transform `node`.\n * They can also transform the parent of node (the last of `ancestors`).\n *\n * Replacing `node` itself, if `SKIP` is not returned, still causes its\n * descendants to be walked (which is a bug).\n *\n * When adding or removing previous siblings of `node` (or next siblings, in\n * case of reverse), the `Visitor` should return a new `Index` to specify the\n * sibling to traverse after `node` is traversed.\n * Adding or removing next siblings of `node` (or previous siblings, in case\n * of reverse) is handled as expected without needing to return a new `Index`.\n *\n * Removing the children property of an ancestor still results in them being\n * traversed.\n * @param {Visited} node\n * Found node.\n * @param {Array<VisitedParents>} ancestors\n * Ancestors of `node`.\n * @returns {VisitorResult}\n * What to do next.\n *\n * An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n * An `Action` is treated as a tuple of `[Action]`.\n *\n * Passing a tuple back only makes sense if the `Action` is `SKIP`.\n * When the `Action` is `EXIT`, that action can be returned.\n * When the `Action` is `CONTINUE`, `Index` can be returned.\n * @template {UnistNode} [Visited=UnistNode]\n * Visited node type.\n * @template {UnistParent} [VisitedParents=UnistParent]\n * Ancestor type.\n */\n\n/**\n * @typedef {Visitor<Matches<InclusiveDescendant<Tree>, Check>, Ancestor<Tree, Matches<InclusiveDescendant<Tree>, Check>>>} BuildVisitor\n * Build a typed `Visitor` function from a tree and a test.\n *\n * It will infer which values are passed as `node` and which as `parents`.\n * @template {UnistNode} [Tree=UnistNode]\n * Tree type.\n * @template {Test} [Check=Test]\n * Test type.\n */\n\nimport {convert} from 'unist-util-is'\nimport {color} from 'unist-util-visit-parents/do-not-use-color'\n\n/** @type {Readonly<ActionTuple>} */\nconst empty = []\n\n/**\n * Continue traversing as normal.\n */\nexport const CONTINUE = true\n\n/**\n * Stop traversing immediately.\n */\nexport const EXIT = false\n\n/**\n * Do not traverse this node’s children.\n */\nexport const SKIP = 'skip'\n\n/**\n * Visit nodes, with ancestral information.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @overload\n * @param {Tree} tree\n * @param {Check} check\n * @param {BuildVisitor<Tree, Check>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @overload\n * @param {Tree} tree\n * @param {BuildVisitor<Tree>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @param {UnistNode} tree\n * Tree to traverse.\n * @param {Visitor | Test} test\n * `unist-util-is`-compatible test\n * @param {Visitor | boolean | null | undefined} [visitor]\n * Handle each node.\n * @param {boolean | null | undefined} [reverse]\n * Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns {undefined}\n * Nothing.\n *\n * @template {UnistNode} Tree\n * Node type.\n * @template {Test} Check\n * `unist-util-is`-compatible test.\n */\nexport function visitParents(tree, test, visitor, reverse) {\n /** @type {Test} */\n let check\n\n if (typeof test === 'function' && typeof visitor !== 'function') {\n reverse = visitor\n // @ts-expect-error no visitor given, so `visitor` is test.\n visitor = test\n } else {\n // @ts-expect-error visitor given, so `test` isn’t a visitor.\n check = test\n }\n\n const is = convert(check)\n const step = reverse ? -1 : 1\n\n factory(tree, undefined, [])()\n\n /**\n * @param {UnistNode} node\n * @param {number | undefined} index\n * @param {Array<UnistParent>} parents\n */\n function factory(node, index, parents) {\n const value = /** @type {Record<string, unknown>} */ (\n node && typeof node === 'object' ? node : {}\n )\n\n if (typeof value.type === 'string') {\n const name =\n // `hast`\n typeof value.tagName === 'string'\n ? value.tagName\n : // `xast`\n typeof value.name === 'string'\n ? value.name\n : undefined\n\n Object.defineProperty(visit, 'name', {\n value:\n 'node (' + color(node.type + (name ? '<' + name + '>' : '')) + ')'\n })\n }\n\n return visit\n\n function visit() {\n /** @type {Readonly<ActionTuple>} */\n let result = empty\n /** @type {Readonly<ActionTuple>} */\n let subresult\n /** @type {number} */\n let offset\n /** @type {Array<UnistParent>} */\n let grandparents\n\n if (!test || is(node, index, parents[parents.length - 1] || undefined)) {\n // @ts-expect-error: `visitor` is now a visitor.\n result = toResult(visitor(node, parents))\n\n if (result[0] === EXIT) {\n return result\n }\n }\n\n if ('children' in node && node.children) {\n const nodeAsParent = /** @type {UnistParent} */ (node)\n\n if (nodeAsParent.children && result[0] !== SKIP) {\n offset = (reverse ? nodeAsParent.children.length : -1) + step\n grandparents = parents.concat(nodeAsParent)\n\n while (offset > -1 && offset < nodeAsParent.children.length) {\n const child = nodeAsParent.children[offset]\n\n subresult = factory(child, offset, grandparents)()\n\n if (subresult[0] === EXIT) {\n return subresult\n }\n\n offset =\n typeof subresult[1] === 'number' ? subresult[1] : offset + step\n }\n }\n }\n\n return result\n }\n }\n}\n\n/**\n * Turn a return value into a clean result.\n *\n * @param {VisitorResult} value\n * Valid return values from visitors.\n * @returns {Readonly<ActionTuple>}\n * Clean result.\n */\nfunction toResult(value) {\n if (Array.isArray(value)) {\n return value\n }\n\n if (typeof value === 'number') {\n return [CONTINUE, value]\n }\n\n return value === null || value === undefined ? empty : [value]\n}\n","/**\n * remark-lint rule to warn when GFM autolink literals are used.\n *\n * ## What is this?\n *\n * This package checks that regular autolinks or full links are used.\n * Literal autolinks is a GFM feature enabled with\n * [`remark-gfm`][github-remark-gfm].\n *\n * ## When should I use this?\n *\n * You can use this package to check that links are consistent.\n *\n * ## API\n *\n * ### `unified().use(remarkLintNoLiteralUrls)`\n *\n * Warn when GFM autolink literals are used.\n *\n * ###### Parameters\n *\n * There are no options.\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * ## Recommendation\n *\n * GFM autolink literals (just a raw URL) are a feature enabled by GFM.\n * They don’t work everywhere.\n * So,\n * it’s recommended to instead use regular autolinks (`<https://url>`) or full\n * links (`[text](url)`).\n *\n * ## Fix\n *\n * [`remark-stringify`][github-remark-stringify] never generates GFM autolink\n * literals.\n * It always generates regular autolinks or full links.\n *\n * [api-remark-lint-no-literal-urls]: #unifieduseremarklintnoliteralurls\n * [github-remark-gfm]: https://github.com/remarkjs/remark-gfm\n * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify\n * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\n *\n * @module no-literal-urls\n * @author Titus Wormer\n * @copyright Titus Wormer\n * @license MIT\n *\n * @example\n * {\"name\": \"ok.md\", \"gfm\": true}\n *\n * <https://example.com/mercury/>\n *\n * .\n *\n * @example\n * {\"name\": \"not-ok.md\", \"label\": \"input\", \"gfm\": true}\n *\n * https://example.com/mercury/\n *\n * www.example.com/venus/\n *\n * earth@mars.planets\n *\n * @example\n * {\"name\": \"not-ok.md\", \"label\": \"output\", \"gfm\": true}\n *\n * 1:1-1:29: Unexpected GFM autolink literal, expected regular autolink, add `<` before and `>` after\n * 3:1-3:23: Unexpected GFM autolink literal, expected regular autolink, add `<http://` before and `>` after\n * 5:1-5:19: Unexpected GFM autolink literal, expected regular autolink, add `<mailto:` before and `>` after\n */\n\n/**\n * @import {Root} from 'mdast'\n */\n\nimport {toString} from 'mdast-util-to-string'\nimport {asciiPunctuation} from 'micromark-util-character'\nimport {lintRule} from 'unified-lint-rule'\nimport {pointStart} from 'unist-util-position'\nimport {visitParents} from 'unist-util-visit-parents'\n\nconst defaultHttp = 'http://'\nconst defaultMailto = 'mailto:'\n\nconst remarkLintNoLiteralUrls = lintRule(\n {\n origin: 'remark-lint:no-literal-urls',\n url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-literal-urls#readme'\n },\n /**\n * @param {Root} tree\n * Tree.\n * @returns {undefined}\n * Nothing.\n */\n function (tree, file) {\n const value = String(file)\n\n visitParents(tree, 'link', function (node, parents) {\n const start = pointStart(node)\n\n if (!start || typeof start.offset !== 'number') return\n\n const raw = toString(node)\n\n /** @type {string | undefined} */\n let protocol\n let otherwiseFine = false\n\n if (raw === node.url) {\n otherwiseFine = true\n } else if (defaultHttp + raw === node.url) {\n protocol = defaultHttp\n } else if (defaultMailto + raw === node.url) {\n protocol = defaultMailto\n }\n\n if (\n // If the url is the same as the content…\n (protocol || otherwiseFine) &&\n // …and it doesn’t start with a marker.\n !asciiPunctuation(value.charCodeAt(start.offset))\n ) {\n file.message(\n 'Unexpected GFM autolink literal, expected regular autolink, add ' +\n (protocol ? '`<' + protocol + '`' : '`<`') +\n ' before and `>` after',\n {ancestors: [...parents, node], place: node.position}\n )\n }\n })\n }\n)\n\nexport default remarkLintNoLiteralUrls\n","/**\n * Throw a given error.\n *\n * @param {Error|null|undefined} [error]\n * Maybe error.\n * @returns {asserts error is null|undefined}\n */\nexport function bail(error) {\n if (error) {\n throw error\n }\n}\n","'use strict';\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n","export function deprecate(fn) {\n return fn\n}\n\nexport function equal() {}\n\nexport function ok() {}\n\nexport function unreachable() {}\n","export default function isPlainObject(value) {\n\tif (typeof value !== 'object' || value === null) {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Point} Point\n * @typedef {import('unist').Position} Position\n */\n\n/**\n * @typedef NodeLike\n * @property {string} type\n * @property {PositionLike | null | undefined} [position]\n *\n * @typedef PointLike\n * @property {number | null | undefined} [line]\n * @property {number | null | undefined} [column]\n * @property {number | null | undefined} [offset]\n *\n * @typedef PositionLike\n * @property {PointLike | null | undefined} [start]\n * @property {PointLike | null | undefined} [end]\n */\n\n/**\n * Serialize the positional info of a point, position (start and end points),\n * or node.\n *\n * @param {Node | NodeLike | Point | PointLike | Position | PositionLike | null | undefined} [value]\n * Node, position, or point.\n * @returns {string}\n * Pretty printed positional info of a node (`string`).\n *\n * In the format of a range `ls:cs-le:ce` (when given `node` or `position`)\n * or a point `l:c` (when given `point`), where `l` stands for line, `c` for\n * column, `s` for `start`, and `e` for end.\n * An empty string (`''`) is returned if the given value is neither `node`,\n * `position`, nor `point`.\n */\nexport function stringifyPosition(value) {\n // Nothing.\n if (!value || typeof value !== 'object') {\n return ''\n }\n\n // Node.\n if ('position' in value || 'type' in value) {\n return position(value.position)\n }\n\n // Position.\n if ('start' in value || 'end' in value) {\n return position(value)\n }\n\n // Point.\n if ('line' in value || 'column' in value) {\n return point(value)\n }\n\n // ?\n return ''\n}\n\n/**\n * @param {Point | PointLike | null | undefined} point\n * @returns {string}\n */\nfunction point(point) {\n return index(point && point.line) + ':' + index(point && point.column)\n}\n\n/**\n * @param {Position | PositionLike | null | undefined} pos\n * @returns {string}\n */\nfunction position(pos) {\n return point(pos && pos.start) + '-' + point(pos && pos.end)\n}\n\n/**\n * @param {number | null | undefined} value\n * @returns {number}\n */\nfunction index(value) {\n return value && typeof value === 'number' ? value : 1\n}\n","/**\n * @import {Node, Point, Position} from 'unist'\n */\n\n/**\n * @typedef {object & {type: string, position?: Position | undefined}} NodeLike\n *\n * @typedef Options\n * Configuration.\n * @property {Array<Node> | null | undefined} [ancestors]\n * Stack of (inclusive) ancestor nodes surrounding the message (optional).\n * @property {Error | null | undefined} [cause]\n * Original error cause of the message (optional).\n * @property {Point | Position | null | undefined} [place]\n * Place of message (optional).\n * @property {string | null | undefined} [ruleId]\n * Category of message (optional, example: `'my-rule'`).\n * @property {string | null | undefined} [source]\n * Namespace of who sent the message (optional, example: `'my-package'`).\n */\n\nimport {stringifyPosition} from 'unist-util-stringify-position'\n\n/**\n * Message.\n */\nexport class VFileMessage extends Error {\n /**\n * Create a message for `reason`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {Options | null | undefined} [options]\n * @returns\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns\n * Instance of `VFileMessage`.\n */\n // eslint-disable-next-line complexity\n constructor(causeOrReason, optionsOrParentOrPlace, origin) {\n super()\n\n if (typeof optionsOrParentOrPlace === 'string') {\n origin = optionsOrParentOrPlace\n optionsOrParentOrPlace = undefined\n }\n\n /** @type {string} */\n let reason = ''\n /** @type {Options} */\n let options = {}\n let legacyCause = false\n\n if (optionsOrParentOrPlace) {\n // Point.\n if (\n 'line' in optionsOrParentOrPlace &&\n 'column' in optionsOrParentOrPlace\n ) {\n options = {place: optionsOrParentOrPlace}\n }\n // Position.\n else if (\n 'start' in optionsOrParentOrPlace &&\n 'end' in optionsOrParentOrPlace\n ) {\n options = {place: optionsOrParentOrPlace}\n }\n // Node.\n else if ('type' in optionsOrParentOrPlace) {\n options = {\n ancestors: [optionsOrParentOrPlace],\n place: optionsOrParentOrPlace.position\n }\n }\n // Options.\n else {\n options = {...optionsOrParentOrPlace}\n }\n }\n\n if (typeof causeOrReason === 'string') {\n reason = causeOrReason\n }\n // Error.\n else if (!options.cause && causeOrReason) {\n legacyCause = true\n reason = causeOrReason.message\n options.cause = causeOrReason\n }\n\n if (!options.ruleId && !options.source && typeof origin === 'string') {\n const index = origin.indexOf(':')\n\n if (index === -1) {\n options.ruleId = origin\n } else {\n options.source = origin.slice(0, index)\n options.ruleId = origin.slice(index + 1)\n }\n }\n\n if (!options.place && options.ancestors && options.ancestors) {\n const parent = options.ancestors[options.ancestors.length - 1]\n\n if (parent) {\n options.place = parent.position\n }\n }\n\n const start =\n options.place && 'start' in options.place\n ? options.place.start\n : options.place\n\n /**\n * Stack of ancestor nodes surrounding the message.\n *\n * @type {Array<Node> | undefined}\n */\n this.ancestors = options.ancestors || undefined\n\n /**\n * Original error cause of the message.\n *\n * @type {Error | undefined}\n */\n this.cause = options.cause || undefined\n\n /**\n * Starting column of message.\n *\n * @type {number | undefined}\n */\n this.column = start ? start.column : undefined\n\n /**\n * State of problem.\n *\n * * `true` — error, file not usable\n * * `false` — warning, change may be needed\n * * `undefined` — change likely not needed\n *\n * @type {boolean | null | undefined}\n */\n this.fatal = undefined\n\n /**\n * Path of a file (used throughout the `VFile` ecosystem).\n *\n * @type {string | undefined}\n */\n this.file = ''\n\n // Field from `Error`.\n /**\n * Reason for message.\n *\n * @type {string}\n */\n this.message = reason\n\n /**\n * Starting line of error.\n *\n * @type {number | undefined}\n */\n this.line = start ? start.line : undefined\n\n // Field from `Error`.\n /**\n * Serialized positional info of message.\n *\n * On normal errors, this would be something like `ParseError`, buit in\n * `VFile` messages we use this space to show where an error happened.\n */\n this.name = stringifyPosition(options.place) || '1:1'\n\n /**\n * Place of message.\n *\n * @type {Point | Position | undefined}\n */\n this.place = options.place || undefined\n\n /**\n * Reason for message, should use markdown.\n *\n * @type {string}\n */\n this.reason = this.message\n\n /**\n * Category of message (example: `'my-rule'`).\n *\n * @type {string | undefined}\n */\n this.ruleId = options.ruleId || undefined\n\n /**\n * Namespace of message (example: `'my-package'`).\n *\n * @type {string | undefined}\n */\n this.source = options.source || undefined\n\n // Field from `Error`.\n /**\n * Stack of message.\n *\n * This is used by normal errors to show where something happened in\n * programming code, irrelevant for `VFile` messages,\n *\n * @type {string}\n */\n this.stack =\n legacyCause && options.cause && typeof options.cause.stack === 'string'\n ? options.cause.stack\n : ''\n\n // The following fields are “well known”.\n // Not standard.\n // Feel free to add other non-standard fields to your messages.\n\n /**\n * Specify the source value that’s being reported, which is deemed\n * incorrect.\n *\n * @type {string | undefined}\n */\n this.actual = undefined\n\n /**\n * Suggest acceptable values that can be used instead of `actual`.\n *\n * @type {Array<string> | undefined}\n */\n this.expected = undefined\n\n /**\n * Long form description of the message (you should use markdown).\n *\n * @type {string | undefined}\n */\n this.note = undefined\n\n /**\n * Link to docs for the message.\n *\n * > 👉 **Note**: this must be an absolute URL that can be passed as `x`\n * > to `new URL(x)`.\n *\n * @type {string | undefined}\n */\n this.url = undefined\n }\n}\n\nVFileMessage.prototype.file = ''\nVFileMessage.prototype.name = ''\nVFileMessage.prototype.reason = ''\nVFileMessage.prototype.message = ''\nVFileMessage.prototype.stack = ''\nVFileMessage.prototype.column = undefined\nVFileMessage.prototype.line = undefined\nVFileMessage.prototype.ancestors = undefined\nVFileMessage.prototype.cause = undefined\nVFileMessage.prototype.fatal = undefined\nVFileMessage.prototype.place = undefined\nVFileMessage.prototype.ruleId = undefined\nVFileMessage.prototype.source = undefined\n","/**\n * Checks if a value has the shape of a WHATWG URL object.\n *\n * Using a symbol or instanceof would not be able to recognize URL objects\n * coming from other implementations (e.g. in Electron), so instead we are\n * checking some well known properties for a lack of a better test.\n *\n * We use `href` and `protocol` as they are the only properties that are\n * easy to retrieve and calculate due to the lazy nature of the getters.\n *\n * We check for auth attribute to distinguish legacy url instance with\n * WHATWG URL instance.\n *\n * @param {unknown} fileUrlOrPath\n * File path or URL.\n * @returns {fileUrlOrPath is URL}\n * Whether it’s a URL.\n */\n// From: <https://github.com/nodejs/node/blob/6a3403c/lib/internal/url.js#L720>\nexport function isUrl(fileUrlOrPath) {\n return Boolean(\n fileUrlOrPath !== null &&\n typeof fileUrlOrPath === 'object' &&\n 'href' in fileUrlOrPath &&\n fileUrlOrPath.href &&\n 'protocol' in fileUrlOrPath &&\n fileUrlOrPath.protocol &&\n // @ts-expect-error: indexing is fine.\n fileUrlOrPath.auth === undefined\n )\n}\n","/**\n * @import {Node, Point, Position} from 'unist'\n * @import {Options as MessageOptions} from 'vfile-message'\n * @import {Compatible, Data, Map, Options, Value} from 'vfile'\n */\n\n/**\n * @typedef {object & {type: string, position?: Position | undefined}} NodeLike\n */\n\nimport {VFileMessage} from 'vfile-message'\nimport {minpath} from '#minpath'\nimport {minproc} from '#minproc'\nimport {urlToPath, isUrl} from '#minurl'\n\n/**\n * Order of setting (least specific to most), we need this because otherwise\n * `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a\n * stem can be set.\n */\nconst order = /** @type {const} */ ([\n 'history',\n 'path',\n 'basename',\n 'stem',\n 'extname',\n 'dirname'\n])\n\nexport class VFile {\n /**\n * Create a new virtual file.\n *\n * `options` is treated as:\n *\n * * `string` or `Uint8Array` — `{value: options}`\n * * `URL` — `{path: options}`\n * * `VFile` — shallow copies its data over to the new file\n * * `object` — all fields are shallow copied over to the new file\n *\n * Path related fields are set in the following order (least specific to\n * most specific): `history`, `path`, `basename`, `stem`, `extname`,\n * `dirname`.\n *\n * You cannot set `dirname` or `extname` without setting either `history`,\n * `path`, `basename`, or `stem` too.\n *\n * @param {Compatible | null | undefined} [value]\n * File value.\n * @returns\n * New instance.\n */\n constructor(value) {\n /** @type {Options | VFile} */\n let options\n\n if (!value) {\n options = {}\n } else if (isUrl(value)) {\n options = {path: value}\n } else if (typeof value === 'string' || isUint8Array(value)) {\n options = {value}\n } else {\n options = value\n }\n\n /* eslint-disable no-unused-expressions */\n\n /**\n * Base of `path` (default: `process.cwd()` or `'/'` in browsers).\n *\n * @type {string}\n */\n // Prevent calling `cwd` (which could be expensive) if it’s not needed;\n // the empty string will be overridden in the next block.\n this.cwd = 'cwd' in options ? '' : minproc.cwd()\n\n /**\n * Place to store custom info (default: `{}`).\n *\n * It’s OK to store custom data directly on the file but moving it to\n * `data` is recommended.\n *\n * @type {Data}\n */\n this.data = {}\n\n /**\n * List of file paths the file moved between.\n *\n * The first is the original path and the last is the current path.\n *\n * @type {Array<string>}\n */\n this.history = []\n\n /**\n * List of messages associated with the file.\n *\n * @type {Array<VFileMessage>}\n */\n this.messages = []\n\n /**\n * Raw value.\n *\n * @type {Value}\n */\n this.value\n\n // The below are non-standard, they are “well-known”.\n // As in, used in several tools.\n /**\n * Source map.\n *\n * This type is equivalent to the `RawSourceMap` type from the `source-map`\n * module.\n *\n * @type {Map | null | undefined}\n */\n this.map\n\n /**\n * Custom, non-string, compiled, representation.\n *\n * This is used by unified to store non-string results.\n * One example is when turning markdown into React nodes.\n *\n * @type {unknown}\n */\n this.result\n\n /**\n * Whether a file was saved to disk.\n *\n * This is used by vfile reporters.\n *\n * @type {boolean}\n */\n this.stored\n /* eslint-enable no-unused-expressions */\n\n // Set path related properties in the correct order.\n let index = -1\n\n while (++index < order.length) {\n const field = order[index]\n\n // Note: we specifically use `in` instead of `hasOwnProperty` to accept\n // `vfile`s too.\n if (\n field in options &&\n options[field] !== undefined &&\n options[field] !== null\n ) {\n // @ts-expect-error: TS doesn’t understand basic reality.\n this[field] = field === 'history' ? [...options[field]] : options[field]\n }\n }\n\n /** @type {string} */\n let field\n\n // Set non-path related properties.\n for (field in options) {\n // @ts-expect-error: fine to set other things.\n if (!order.includes(field)) {\n // @ts-expect-error: fine to set other things.\n this[field] = options[field]\n }\n }\n }\n\n /**\n * Get the basename (including extname) (example: `'index.min.js'`).\n *\n * @returns {string | undefined}\n * Basename.\n */\n get basename() {\n return typeof this.path === 'string'\n ? minpath.basename(this.path)\n : undefined\n }\n\n /**\n * Set basename (including extname) (`'index.min.js'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n *\n * @param {string} basename\n * Basename.\n * @returns {undefined}\n * Nothing.\n */\n set basename(basename) {\n assertNonEmpty(basename, 'basename')\n assertPart(basename, 'basename')\n this.path = minpath.join(this.dirname || '', basename)\n }\n\n /**\n * Get the parent path (example: `'~'`).\n *\n * @returns {string | undefined}\n * Dirname.\n */\n get dirname() {\n return typeof this.path === 'string'\n ? minpath.dirname(this.path)\n : undefined\n }\n\n /**\n * Set the parent path (example: `'~'`).\n *\n * Cannot be set if there’s no `path` yet.\n *\n * @param {string | undefined} dirname\n * Dirname.\n * @returns {undefined}\n * Nothing.\n */\n set dirname(dirname) {\n assertPath(this.basename, 'dirname')\n this.path = minpath.join(dirname || '', this.basename)\n }\n\n /**\n * Get the extname (including dot) (example: `'.js'`).\n *\n * @returns {string | undefined}\n * Extname.\n */\n get extname() {\n return typeof this.path === 'string'\n ? minpath.extname(this.path)\n : undefined\n }\n\n /**\n * Set the extname (including dot) (example: `'.js'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be set if there’s no `path` yet.\n *\n * @param {string | undefined} extname\n * Extname.\n * @returns {undefined}\n * Nothing.\n */\n set extname(extname) {\n assertPart(extname, 'extname')\n assertPath(this.dirname, 'extname')\n\n if (extname) {\n if (extname.codePointAt(0) !== 46 /* `.` */) {\n throw new Error('`extname` must start with `.`')\n }\n\n if (extname.includes('.', 1)) {\n throw new Error('`extname` cannot contain multiple dots')\n }\n }\n\n this.path = minpath.join(this.dirname, this.stem + (extname || ''))\n }\n\n /**\n * Get the full path (example: `'~/index.min.js'`).\n *\n * @returns {string}\n * Path.\n */\n get path() {\n return this.history[this.history.length - 1]\n }\n\n /**\n * Set the full path (example: `'~/index.min.js'`).\n *\n * Cannot be nullified.\n * You can set a file URL (a `URL` object with a `file:` protocol) which will\n * be turned into a path with `url.fileURLToPath`.\n *\n * @param {URL | string} path\n * Path.\n * @returns {undefined}\n * Nothing.\n */\n set path(path) {\n if (isUrl(path)) {\n path = urlToPath(path)\n }\n\n assertNonEmpty(path, 'path')\n\n if (this.path !== path) {\n this.history.push(path)\n }\n }\n\n /**\n * Get the stem (basename w/o extname) (example: `'index.min'`).\n *\n * @returns {string | undefined}\n * Stem.\n */\n get stem() {\n return typeof this.path === 'string'\n ? minpath.basename(this.path, this.extname)\n : undefined\n }\n\n /**\n * Set the stem (basename w/o extname) (example: `'index.min'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n *\n * @param {string} stem\n * Stem.\n * @returns {undefined}\n * Nothing.\n */\n set stem(stem) {\n assertNonEmpty(stem, 'stem')\n assertPart(stem, 'stem')\n this.path = minpath.join(this.dirname || '', stem + (this.extname || ''))\n }\n\n // Normal prototypal methods.\n /**\n * Create a fatal message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `true` (error; file not usable)\n * and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {never}\n * Never.\n * @throws {VFileMessage}\n * Message.\n */\n fail(causeOrReason, optionsOrParentOrPlace, origin) {\n // @ts-expect-error: the overloads are fine.\n const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n message.fatal = true\n\n throw message\n }\n\n /**\n * Create an info message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `undefined` (info; change\n * likely not needed) and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {VFileMessage}\n * Message.\n */\n info(causeOrReason, optionsOrParentOrPlace, origin) {\n // @ts-expect-error: the overloads are fine.\n const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n message.fatal = undefined\n\n return message\n }\n\n /**\n * Create a message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `false` (warning; change may be\n * needed) and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {VFileMessage}\n * Message.\n */\n message(causeOrReason, optionsOrParentOrPlace, origin) {\n const message = new VFileMessage(\n // @ts-expect-error: the overloads are fine.\n causeOrReason,\n optionsOrParentOrPlace,\n origin\n )\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n }\n\n /**\n * Serialize the file.\n *\n * > **Note**: which encodings are supported depends on the engine.\n * > For info on Node.js, see:\n * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>.\n *\n * @param {string | null | undefined} [encoding='utf8']\n * Character encoding to understand `value` as when it’s a `Uint8Array`\n * (default: `'utf-8'`).\n * @returns {string}\n * Serialized file.\n */\n toString(encoding) {\n if (this.value === undefined) {\n return ''\n }\n\n if (typeof this.value === 'string') {\n return this.value\n }\n\n const decoder = new TextDecoder(encoding || undefined)\n return decoder.decode(this.value)\n }\n}\n\n/**\n * Assert that `part` is not a path (as in, does not contain `path.sep`).\n *\n * @param {string | null | undefined} part\n * File path part.\n * @param {string} name\n * Part name.\n * @returns {undefined}\n * Nothing.\n */\nfunction assertPart(part, name) {\n if (part && part.includes(minpath.sep)) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + minpath.sep + '`'\n )\n }\n}\n\n/**\n * Assert that `part` is not empty.\n *\n * @param {string | undefined} part\n * Thing.\n * @param {string} name\n * Part name.\n * @returns {asserts part is string}\n * Nothing.\n */\nfunction assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}\n\n/**\n * Assert `path` exists.\n *\n * @param {string | undefined} path\n * Path.\n * @param {string} name\n * Dependency name.\n * @returns {asserts path is string}\n * Nothing.\n */\nfunction assertPath(path, name) {\n if (!path) {\n throw new Error('Setting `' + name + '` requires `path` to be set too')\n }\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n * thing.\n * @returns {value is Uint8Array}\n * Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'byteLength' in value &&\n 'byteOffset' in value\n )\n}\n","export const CallableInstance =\n /**\n * @type {new <Parameters extends Array<unknown>, Result>(property: string | symbol) => (...parameters: Parameters) => Result}\n */\n (\n /** @type {unknown} */\n (\n /**\n * @this {Function}\n * @param {string | symbol} property\n * @returns {(...parameters: Array<unknown>) => unknown}\n */\n function (property) {\n const self = this\n const constr = self.constructor\n const proto = /** @type {Record<string | symbol, Function>} */ (\n // Prototypes do exist.\n // type-coverage:ignore-next-line\n constr.prototype\n )\n const value = proto[property]\n /** @type {(...parameters: Array<unknown>) => unknown} */\n const apply = function () {\n return value.apply(apply, arguments)\n }\n\n Object.setPrototypeOf(apply, proto)\n\n // Not needed for us in `unified`: we only call this on the `copy`\n // function,\n // and we don't need to add its fields (`length`, `name`)\n // over.\n // See also: GH-246.\n // const names = Object.getOwnPropertyNames(value)\n //\n // for (const p of names) {\n // const descriptor = Object.getOwnPropertyDescriptor(value, p)\n // if (descriptor) Object.defineProperty(apply, p, descriptor)\n // }\n\n return apply\n }\n )\n )\n","/**\n * @typedef {import('trough').Pipeline} Pipeline\n *\n * @typedef {import('unist').Node} Node\n *\n * @typedef {import('vfile').Compatible} Compatible\n * @typedef {import('vfile').Value} Value\n *\n * @typedef {import('../index.js').CompileResultMap} CompileResultMap\n * @typedef {import('../index.js').Data} Data\n * @typedef {import('../index.js').Settings} Settings\n */\n\n/**\n * @typedef {CompileResultMap[keyof CompileResultMap]} CompileResults\n * Acceptable results from compilers.\n *\n * To register custom results, add them to\n * {@linkcode CompileResultMap}.\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The node that the compiler receives (default: `Node`).\n * @template {CompileResults} [Result=CompileResults]\n * The thing that the compiler yields (default: `CompileResults`).\n * @callback Compiler\n * A **compiler** handles the compiling of a syntax tree to something else\n * (in most cases, text) (TypeScript type).\n *\n * It is used in the stringify phase and called with a {@linkcode Node}\n * and {@linkcode VFile} representation of the document to compile.\n * It should return the textual representation of the given tree (typically\n * `string`).\n *\n * > **Note**: unified typically compiles by serializing: most compilers\n * > return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n * @param {Tree} tree\n * Tree to compile.\n * @param {VFile} file\n * File associated with `tree`.\n * @returns {Result}\n * New content: compiled text (`string` or `Uint8Array`, for `file.value`) or\n * something else (for `file.result`).\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The node that the parser yields (default: `Node`)\n * @callback Parser\n * A **parser** handles the parsing of text to a syntax tree.\n *\n * It is used in the parse phase and is called with a `string` and\n * {@linkcode VFile} of the document to parse.\n * It must return the syntax tree representation of the given file\n * ({@linkcode Node}).\n * @param {string} document\n * Document to parse.\n * @param {VFile} file\n * File associated with `document`.\n * @returns {Tree}\n * Node representing the given file.\n */\n\n/**\n * @typedef {(\n * Plugin<Array<any>, any, any> |\n * PluginTuple<Array<any>, any, any> |\n * Preset\n * )} Pluggable\n * Union of the different ways to add plugins and settings.\n */\n\n/**\n * @typedef {Array<Pluggable>} PluggableList\n * List of plugins and presets.\n */\n\n// Note: we can’t use `callback` yet as it messes up `this`:\n// <https://github.com/microsoft/TypeScript/issues/55197>.\n/**\n * @template {Array<unknown>} [PluginParameters=[]]\n * Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=Node]\n * Value that is expected as input (default: `Node`).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node it expects.\n * * If the plugin sets a {@linkcode Parser}, this should be\n * `string`.\n * * If the plugin sets a {@linkcode Compiler}, this should be the\n * node it expects.\n * @template [Output=Input]\n * Value that is yielded as output (default: `Input`).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node that that yields.\n * * If the plugin sets a {@linkcode Parser}, this should be the\n * node that it yields.\n * * If the plugin sets a {@linkcode Compiler}, this should be\n * result it yields.\n * @typedef {(\n * (this: Processor, ...parameters: PluginParameters) =>\n * Input extends string ? // Parser.\n * Output extends Node | undefined ? undefined | void : never :\n * Output extends CompileResults ? // Compiler.\n * Input extends Node | undefined ? undefined | void : never :\n * Transformer<\n * Input extends Node ? Input : Node,\n * Output extends Node ? Output : Node\n * > | undefined | void\n * )} Plugin\n * Single plugin.\n *\n * Plugins configure the processors they are applied on in the following\n * ways:\n *\n * * they change the processor, such as the parser, the compiler, or by\n * configuring data\n * * they specify how to handle trees and files\n *\n * In practice, they are functions that can receive options and configure the\n * processor (`this`).\n *\n * > **Note**: plugins are called when the processor is *frozen*, not when\n * > they are applied.\n */\n\n/**\n * Tuple of a plugin and its configuration.\n *\n * The first item is a plugin, the rest are its parameters.\n *\n * @template {Array<unknown>} [TupleParameters=[]]\n * Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=undefined]\n * Value that is expected as input (optional).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node it expects.\n * * If the plugin sets a {@linkcode Parser}, this should be\n * `string`.\n * * If the plugin sets a {@linkcode Compiler}, this should be the\n * node it expects.\n * @template [Output=undefined] (optional).\n * Value that is yielded as output.\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node that that yields.\n * * If the plugin sets a {@linkcode Parser}, this should be the\n * node that it yields.\n * * If the plugin sets a {@linkcode Compiler}, this should be\n * result it yields.\n * @typedef {(\n * [\n * plugin: Plugin<TupleParameters, Input, Output>,\n * ...parameters: TupleParameters\n * ]\n * )} PluginTuple\n */\n\n/**\n * @typedef Preset\n * Sharable configuration.\n *\n * They can contain plugins and settings.\n * @property {PluggableList | undefined} [plugins]\n * List of plugins and presets (optional).\n * @property {Settings | undefined} [settings]\n * Shared settings for parsers and compilers (optional).\n */\n\n/**\n * @template {VFile} [File=VFile]\n * The file that the callback receives (default: `VFile`).\n * @callback ProcessCallback\n * Callback called when the process is done.\n *\n * Called with either an error or a result.\n * @param {Error | undefined} [error]\n * Fatal error (optional).\n * @param {File | undefined} [file]\n * Processed file (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The tree that the callback receives (default: `Node`).\n * @callback RunCallback\n * Callback called when transformers are done.\n *\n * Called with either an error or results.\n * @param {Error | undefined} [error]\n * Fatal error (optional).\n * @param {Tree | undefined} [tree]\n * Transformed tree (optional).\n * @param {VFile | undefined} [file]\n * File (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Output=Node]\n * Node type that the transformer yields (default: `Node`).\n * @callback TransformCallback\n * Callback passed to transforms.\n *\n * If the signature of a `transformer` accepts a third argument, the\n * transformer may perform asynchronous operations, and must call it.\n * @param {Error | undefined} [error]\n * Fatal error to stop the process (optional).\n * @param {Output | undefined} [tree]\n * New, changed, tree (optional).\n * @param {VFile | undefined} [file]\n * New, changed, file (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Input=Node]\n * Node type that the transformer expects (default: `Node`).\n * @template {Node} [Output=Input]\n * Node type that the transformer yields (default: `Input`).\n * @callback Transformer\n * Transformers handle syntax trees and files.\n *\n * They are functions that are called each time a syntax tree and file are\n * passed through the run phase.\n * When an error occurs in them (either because it’s thrown, returned,\n * rejected, or passed to `next`), the process stops.\n *\n * The run phase is handled by [`trough`][trough], see its documentation for\n * the exact semantics of these functions.\n *\n * > **Note**: you should likely ignore `next`: don’t accept it.\n * > it supports callback-style async work.\n * > But promises are likely easier to reason about.\n *\n * [trough]: https://github.com/wooorm/trough#function-fninput-next\n * @param {Input} tree\n * Tree to handle.\n * @param {VFile} file\n * File to handle.\n * @param {TransformCallback<Output>} next\n * Callback.\n * @returns {(\n * Promise<Output | undefined | void> |\n * Promise<never> | // For some reason this is needed separately.\n * Output |\n * Error |\n * undefined |\n * void\n * )}\n * If you accept `next`, nothing.\n * Otherwise:\n *\n * * `Error` — fatal error to stop the process\n * * `Promise<undefined>` or `undefined` — the next transformer keeps using\n * same tree\n * * `Promise<Node>` or `Node` — new, changed, tree\n */\n\n/**\n * @template {Node | undefined} ParseTree\n * Output of `parse`.\n * @template {Node | undefined} HeadTree\n * Input for `run`.\n * @template {Node | undefined} TailTree\n * Output for `run`.\n * @template {Node | undefined} CompileTree\n * Input of `stringify`.\n * @template {CompileResults | undefined} CompileResult\n * Output of `stringify`.\n * @template {Node | string | undefined} Input\n * Input of plugin.\n * @template Output\n * Output of plugin (optional).\n * @typedef {(\n * Input extends string\n * ? Output extends Node | undefined\n * ? // Parser.\n * Processor<\n * Output extends undefined ? ParseTree : Output,\n * HeadTree,\n * TailTree,\n * CompileTree,\n * CompileResult\n * >\n * : // Unknown.\n * Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>\n * : Output extends CompileResults\n * ? Input extends Node | undefined\n * ? // Compiler.\n * Processor<\n * ParseTree,\n * HeadTree,\n * TailTree,\n * Input extends undefined ? CompileTree : Input,\n * Output extends undefined ? CompileResult : Output\n * >\n * : // Unknown.\n * Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>\n * : Input extends Node | undefined\n * ? Output extends Node | undefined\n * ? // Transform.\n * Processor<\n * ParseTree,\n * HeadTree extends undefined ? Input : HeadTree,\n * Output extends undefined ? TailTree : Output,\n * CompileTree,\n * CompileResult\n * >\n * : // Unknown.\n * Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>\n * : // Unknown.\n * Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>\n * )} UsePlugin\n * Create a processor based on the input/output of a {@link Plugin plugin}.\n */\n\n/**\n * @template {CompileResults | undefined} Result\n * Node type that the transformer yields.\n * @typedef {(\n * Result extends Value | undefined ?\n * VFile :\n * VFile & {result: Result}\n * )} VFileWithOutput\n * Type to generate a {@linkcode VFile} corresponding to a compiler result.\n *\n * If a result that is not acceptable on a `VFile` is used, that will\n * be stored on the `result` field of {@linkcode VFile}.\n */\n\nimport {bail} from 'bail'\nimport extend from 'extend'\nimport {ok as assert} from 'devlop'\nimport isPlainObj from 'is-plain-obj'\nimport {trough} from 'trough'\nimport {VFile} from 'vfile'\nimport {CallableInstance} from './callable-instance.js'\n\n// To do: next major: drop `Compiler`, `Parser`: prefer lowercase.\n\n// To do: we could start yielding `never` in TS when a parser is missing and\n// `parse` is called.\n// Currently, we allow directly setting `processor.parser`, which is untyped.\n\nconst own = {}.hasOwnProperty\n\n/**\n * @template {Node | undefined} [ParseTree=undefined]\n * Output of `parse` (optional).\n * @template {Node | undefined} [HeadTree=undefined]\n * Input for `run` (optional).\n * @template {Node | undefined} [TailTree=undefined]\n * Output for `run` (optional).\n * @template {Node | undefined} [CompileTree=undefined]\n * Input of `stringify` (optional).\n * @template {CompileResults | undefined} [CompileResult=undefined]\n * Output of `stringify` (optional).\n * @extends {CallableInstance<[], Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>>}\n */\nexport class Processor extends CallableInstance {\n /**\n * Create a processor.\n */\n constructor() {\n // If `Processor()` is called (w/o new), `copy` is called instead.\n super('copy')\n\n /**\n * Compiler to use (deprecated).\n *\n * @deprecated\n * Use `compiler` instead.\n * @type {(\n * Compiler<\n * CompileTree extends undefined ? Node : CompileTree,\n * CompileResult extends undefined ? CompileResults : CompileResult\n * > |\n * undefined\n * )}\n */\n this.Compiler = undefined\n\n /**\n * Parser to use (deprecated).\n *\n * @deprecated\n * Use `parser` instead.\n * @type {(\n * Parser<ParseTree extends undefined ? Node : ParseTree> |\n * undefined\n * )}\n */\n this.Parser = undefined\n\n // Note: the following fields are considered private.\n // However, they are needed for tests, and TSC generates an untyped\n // `private freezeIndex` field for, which trips `type-coverage` up.\n // Instead, we use `@deprecated` to visualize that they shouldn’t be used.\n /**\n * Internal list of configured plugins.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Array<PluginTuple<Array<unknown>>>}\n */\n this.attachers = []\n\n /**\n * Compiler to use.\n *\n * @type {(\n * Compiler<\n * CompileTree extends undefined ? Node : CompileTree,\n * CompileResult extends undefined ? CompileResults : CompileResult\n * > |\n * undefined\n * )}\n */\n this.compiler = undefined\n\n /**\n * Internal state to track where we are while freezing.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {number}\n */\n this.freezeIndex = -1\n\n /**\n * Internal state to track whether we’re frozen.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {boolean | undefined}\n */\n this.frozen = undefined\n\n /**\n * Internal state.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Data}\n */\n this.namespace = {}\n\n /**\n * Parser to use.\n *\n * @type {(\n * Parser<ParseTree extends undefined ? Node : ParseTree> |\n * undefined\n * )}\n */\n this.parser = undefined\n\n /**\n * Internal list of configured transformers.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Pipeline}\n */\n this.transformers = trough()\n }\n\n /**\n * Copy a processor.\n *\n * @deprecated\n * This is a private internal method and should not be used.\n * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n * New *unfrozen* processor ({@linkcode Processor}) that is\n * configured to work the same as its ancestor.\n * When the descendant processor is configured in the future it does not\n * affect the ancestral processor.\n */\n copy() {\n // Cast as the type parameters will be the same after attaching.\n const destination =\n /** @type {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>} */ (\n new Processor()\n )\n let index = -1\n\n while (++index < this.attachers.length) {\n const attacher = this.attachers[index]\n destination.use(...attacher)\n }\n\n destination.data(extend(true, {}, this.namespace))\n\n return destination\n }\n\n /**\n * Configure the processor with info available to all plugins.\n * Information is stored in an object.\n *\n * Typically, options can be given to a specific plugin, but sometimes it\n * makes sense to have information shared with several plugins.\n * For example, a list of HTML elements that are self-closing, which is\n * needed during all phases.\n *\n * > **Note**: setting information cannot occur on *frozen* processors.\n * > Call the processor first to create a new unfrozen processor.\n *\n * > **Note**: to register custom data in TypeScript, augment the\n * > {@linkcode Data} interface.\n *\n * @example\n * This example show how to get and set info:\n *\n * ```js\n * import {unified} from 'unified'\n *\n * const processor = unified().data('alpha', 'bravo')\n *\n * processor.data('alpha') // => 'bravo'\n *\n * processor.data() // => {alpha: 'bravo'}\n *\n * processor.data({charlie: 'delta'})\n *\n * processor.data() // => {charlie: 'delta'}\n * ```\n *\n * @template {keyof Data} Key\n *\n * @overload\n * @returns {Data}\n *\n * @overload\n * @param {Data} dataset\n * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n *\n * @overload\n * @param {Key} key\n * @returns {Data[Key]}\n *\n * @overload\n * @param {Key} key\n * @param {Data[Key]} value\n * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n *\n * @param {Data | Key} [key]\n * Key to get or set, or entire dataset to set, or nothing to get the\n * entire dataset (optional).\n * @param {Data[Key]} [value]\n * Value to set (optional).\n * @returns {unknown}\n * The current processor when setting, the value at `key` when getting, or\n * the entire dataset when getting without key.\n */\n data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', this.frozen)\n this.namespace[key] = value\n return this\n }\n\n // Get `key`.\n return (own.call(this.namespace, key) && this.namespace[key]) || undefined\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', this.frozen)\n this.namespace = key\n return this\n }\n\n // Get space.\n return this.namespace\n }\n\n /**\n * Freeze a processor.\n *\n * Frozen processors are meant to be extended and not to be configured\n * directly.\n *\n * When a processor is frozen it cannot be unfrozen.\n * New processors working the same way can be created by calling the\n * processor.\n *\n * It’s possible to freeze processors explicitly by calling `.freeze()`.\n * Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,\n * `.stringify()`, `.process()`, or `.processSync()` are called.\n *\n * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n * The current processor.\n */\n freeze() {\n if (this.frozen) {\n return this\n }\n\n // Cast so that we can type plugins easier.\n // Plugins are supposed to be usable on different processors, not just on\n // this exact processor.\n const self = /** @type {Processor} */ (/** @type {unknown} */ (this))\n\n while (++this.freezeIndex < this.attachers.length) {\n const [attacher, ...options] = this.attachers[this.freezeIndex]\n\n if (options[0] === false) {\n continue\n }\n\n if (options[0] === true) {\n options[0] = undefined\n }\n\n const transformer = attacher.call(self, ...options)\n\n if (typeof transformer === 'function') {\n this.transformers.use(transformer)\n }\n }\n\n this.frozen = true\n this.freezeIndex = Number.POSITIVE_INFINITY\n\n return this\n }\n\n /**\n * Parse text to a syntax tree.\n *\n * > **Note**: `parse` freezes the processor if not already *frozen*.\n *\n * > **Note**: `parse` performs the parse phase, not the run phase or other\n * > phases.\n *\n * @param {Compatible | undefined} [file]\n * file to parse (optional); typically `string` or `VFile`; any value\n * accepted as `x` in `new VFile(x)`.\n * @returns {ParseTree extends undefined ? Node : ParseTree}\n * Syntax tree representing `file`.\n */\n parse(file) {\n this.freeze()\n const realFile = vfile(file)\n const parser = this.parser || this.Parser\n assertParser('parse', parser)\n return parser(String(realFile), realFile)\n }\n\n /**\n * Process the given file as configured on the processor.\n *\n * > **Note**: `process` freezes the processor if not already *frozen*.\n *\n * > **Note**: `process` performs the parse, run, and stringify phases.\n *\n * @overload\n * @param {Compatible | undefined} file\n * @param {ProcessCallback<VFileWithOutput<CompileResult>>} done\n * @returns {undefined}\n *\n * @overload\n * @param {Compatible | undefined} [file]\n * @returns {Promise<VFileWithOutput<CompileResult>>}\n *\n * @param {Compatible | undefined} [file]\n * File (optional); typically `string` or `VFile`]; any value accepted as\n * `x` in `new VFile(x)`.\n * @param {ProcessCallback<VFileWithOutput<CompileResult>> | undefined} [done]\n * Callback (optional).\n * @returns {Promise<VFile> | undefined}\n * Nothing if `done` is given.\n * Otherwise a promise, rejected with a fatal error or resolved with the\n * processed file.\n *\n * The parsed, transformed, and compiled value is available at\n * `file.value` (see note).\n *\n * > **Note**: unified typically compiles by serializing: most\n * > compilers return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n process(file, done) {\n const self = this\n\n this.freeze()\n assertParser('process', this.parser || this.Parser)\n assertCompiler('process', this.compiler || this.Compiler)\n\n return done ? executor(undefined, done) : new Promise(executor)\n\n // Note: `void`s needed for TS.\n /**\n * @param {((file: VFileWithOutput<CompileResult>) => undefined | void) | undefined} resolve\n * @param {(error: Error | undefined) => undefined | void} reject\n * @returns {undefined}\n */\n function executor(resolve, reject) {\n const realFile = vfile(file)\n // Assume `ParseTree` (the result of the parser) matches `HeadTree` (the\n // input of the first transform).\n const parseTree =\n /** @type {HeadTree extends undefined ? Node : HeadTree} */ (\n /** @type {unknown} */ (self.parse(realFile))\n )\n\n self.run(parseTree, realFile, function (error, tree, file) {\n if (error || !tree || !file) {\n return realDone(error)\n }\n\n // Assume `TailTree` (the output of the last transform) matches\n // `CompileTree` (the input of the compiler).\n const compileTree =\n /** @type {CompileTree extends undefined ? Node : CompileTree} */ (\n /** @type {unknown} */ (tree)\n )\n\n const compileResult = self.stringify(compileTree, file)\n\n if (looksLikeAValue(compileResult)) {\n file.value = compileResult\n } else {\n file.result = compileResult\n }\n\n realDone(error, /** @type {VFileWithOutput<CompileResult>} */ (file))\n })\n\n /**\n * @param {Error | undefined} error\n * @param {VFileWithOutput<CompileResult> | undefined} [file]\n * @returns {undefined}\n */\n function realDone(error, file) {\n if (error || !file) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n assert(done, '`done` is defined if `resolve` is not')\n done(undefined, file)\n }\n }\n }\n }\n\n /**\n * Process the given file as configured on the processor.\n *\n * An error is thrown if asynchronous transforms are configured.\n *\n * > **Note**: `processSync` freezes the processor if not already *frozen*.\n *\n * > **Note**: `processSync` performs the parse, run, and stringify phases.\n *\n * @param {Compatible | undefined} [file]\n * File (optional); typically `string` or `VFile`; any value accepted as\n * `x` in `new VFile(x)`.\n * @returns {VFileWithOutput<CompileResult>}\n * The processed file.\n *\n * The parsed, transformed, and compiled value is available at\n * `file.value` (see note).\n *\n * > **Note**: unified typically compiles by serializing: most\n * > compilers return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n processSync(file) {\n /** @type {boolean} */\n let complete = false\n /** @type {VFileWithOutput<CompileResult> | undefined} */\n let result\n\n this.freeze()\n assertParser('processSync', this.parser || this.Parser)\n assertCompiler('processSync', this.compiler || this.Compiler)\n\n this.process(file, realDone)\n assertDone('processSync', 'process', complete)\n assert(result, 'we either bailed on an error or have a tree')\n\n return result\n\n /**\n * @type {ProcessCallback<VFileWithOutput<CompileResult>>}\n */\n function realDone(error, file) {\n complete = true\n bail(error)\n result = file\n }\n }\n\n /**\n * Run *transformers* on a syntax tree.\n *\n * > **Note**: `run` freezes the processor if not already *frozen*.\n *\n * > **Note**: `run` performs the run phase, not other phases.\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done\n * @returns {undefined}\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {Compatible | undefined} file\n * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done\n * @returns {undefined}\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {Compatible | undefined} [file]\n * @returns {Promise<TailTree extends undefined ? Node : TailTree>}\n *\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * Tree to transform and inspect.\n * @param {(\n * RunCallback<TailTree extends undefined ? Node : TailTree> |\n * Compatible\n * )} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} [done]\n * Callback (optional).\n * @returns {Promise<TailTree extends undefined ? Node : TailTree> | undefined}\n * Nothing if `done` is given.\n * Otherwise, a promise rejected with a fatal error or resolved with the\n * transformed tree.\n */\n run(tree, file, done) {\n assertNode(tree)\n this.freeze()\n\n const transformers = this.transformers\n\n if (!done && typeof file === 'function') {\n done = file\n file = undefined\n }\n\n return done ? executor(undefined, done) : new Promise(executor)\n\n // Note: `void`s needed for TS.\n /**\n * @param {(\n * ((tree: TailTree extends undefined ? Node : TailTree) => undefined | void) |\n * undefined\n * )} resolve\n * @param {(error: Error) => undefined | void} reject\n * @returns {undefined}\n */\n function executor(resolve, reject) {\n assert(\n typeof file !== 'function',\n '`file` can’t be a `done` anymore, we checked'\n )\n const realFile = vfile(file)\n transformers.run(tree, realFile, realDone)\n\n /**\n * @param {Error | undefined} error\n * @param {Node} outputTree\n * @param {VFile} file\n * @returns {undefined}\n */\n function realDone(error, outputTree, file) {\n const resultingTree =\n /** @type {TailTree extends undefined ? Node : TailTree} */ (\n outputTree || tree\n )\n\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(resultingTree)\n } else {\n assert(done, '`done` is defined if `resolve` is not')\n done(undefined, resultingTree, file)\n }\n }\n }\n }\n\n /**\n * Run *transformers* on a syntax tree.\n *\n * An error is thrown if asynchronous transforms are configured.\n *\n * > **Note**: `runSync` freezes the processor if not already *frozen*.\n *\n * > **Note**: `runSync` performs the run phase, not other phases.\n *\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * Tree to transform and inspect.\n * @param {Compatible | undefined} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @returns {TailTree extends undefined ? Node : TailTree}\n * Transformed tree.\n */\n runSync(tree, file) {\n /** @type {boolean} */\n let complete = false\n /** @type {(TailTree extends undefined ? Node : TailTree) | undefined} */\n let result\n\n this.run(tree, file, realDone)\n\n assertDone('runSync', 'run', complete)\n assert(result, 'we either bailed on an error or have a tree')\n return result\n\n /**\n * @type {RunCallback<TailTree extends undefined ? Node : TailTree>}\n */\n function realDone(error, tree) {\n bail(error)\n result = tree\n complete = true\n }\n }\n\n /**\n * Compile a syntax tree.\n *\n * > **Note**: `stringify` freezes the processor if not already *frozen*.\n *\n * > **Note**: `stringify` performs the stringify phase, not the run phase\n * > or other phases.\n *\n * @param {CompileTree extends undefined ? Node : CompileTree} tree\n * Tree to compile.\n * @param {Compatible | undefined} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @returns {CompileResult extends undefined ? Value : CompileResult}\n * Textual representation of the tree (see note).\n *\n * > **Note**: unified typically compiles by serializing: most compilers\n * > return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n stringify(tree, file) {\n this.freeze()\n const realFile = vfile(file)\n const compiler = this.compiler || this.Compiler\n assertCompiler('stringify', compiler)\n assertNode(tree)\n\n return compiler(tree, realFile)\n }\n\n /**\n * Configure the processor to use a plugin, a list of usable values, or a\n * preset.\n *\n * If the processor is already using a plugin, the previous plugin\n * configuration is changed based on the options that are passed in.\n * In other words, the plugin is not added a second time.\n *\n * > **Note**: `use` cannot be called on *frozen* processors.\n * > Call the processor first to create a new unfrozen processor.\n *\n * @example\n * There are many ways to pass plugins to `.use()`.\n * This example gives an overview:\n *\n * ```js\n * import {unified} from 'unified'\n *\n * unified()\n * // Plugin with options:\n * .use(pluginA, {x: true, y: true})\n * // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):\n * .use(pluginA, {y: false, z: true})\n * // Plugins:\n * .use([pluginB, pluginC])\n * // Two plugins, the second with options:\n * .use([pluginD, [pluginE, {}]])\n * // Preset with plugins and settings:\n * .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})\n * // Settings only:\n * .use({settings: {position: false}})\n * ```\n *\n * @template {Array<unknown>} [Parameters=[]]\n * @template {Node | string | undefined} [Input=undefined]\n * @template [Output=Input]\n *\n * @overload\n * @param {Preset | null | undefined} [preset]\n * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n *\n * @overload\n * @param {PluggableList} list\n * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n *\n * @overload\n * @param {Plugin<Parameters, Input, Output>} plugin\n * @param {...(Parameters | [boolean])} parameters\n * @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}\n *\n * @param {PluggableList | Plugin | Preset | null | undefined} value\n * Usable value.\n * @param {...unknown} parameters\n * Parameters, when a plugin is given as a usable value.\n * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n * Current processor.\n */\n use(value, ...parameters) {\n const attachers = this.attachers\n const namespace = this.namespace\n\n assertUnfrozen('use', this.frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin(value, parameters)\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n\n return this\n\n /**\n * @param {Pluggable} value\n * @returns {undefined}\n */\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value, [])\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n const [plugin, ...parameters] =\n /** @type {PluginTuple<Array<unknown>>} */ (value)\n addPlugin(plugin, parameters)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n }\n\n /**\n * @param {Preset} result\n * @returns {undefined}\n */\n function addPreset(result) {\n if (!('plugins' in result) && !('settings' in result)) {\n throw new Error(\n 'Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither'\n )\n }\n\n addList(result.plugins)\n\n if (result.settings) {\n namespace.settings = extend(true, namespace.settings, result.settings)\n }\n }\n\n /**\n * @param {PluggableList | null | undefined} plugins\n * @returns {undefined}\n */\n function addList(plugins) {\n let index = -1\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (Array.isArray(plugins)) {\n while (++index < plugins.length) {\n const thing = plugins[index]\n add(thing)\n }\n } else {\n throw new TypeError('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n /**\n * @param {Plugin} plugin\n * @param {Array<unknown>} parameters\n * @returns {undefined}\n */\n function addPlugin(plugin, parameters) {\n let index = -1\n let entryIndex = -1\n\n while (++index < attachers.length) {\n if (attachers[index][0] === plugin) {\n entryIndex = index\n break\n }\n }\n\n if (entryIndex === -1) {\n attachers.push([plugin, ...parameters])\n }\n // Only set if there was at least a `primary` value, otherwise we’d change\n // `arguments.length`.\n else if (parameters.length > 0) {\n let [primary, ...rest] = parameters\n const currentPrimary = attachers[entryIndex][1]\n if (isPlainObj(currentPrimary) && isPlainObj(primary)) {\n primary = extend(true, currentPrimary, primary)\n }\n\n attachers[entryIndex] = [plugin, primary, ...rest]\n }\n }\n }\n}\n\n// Note: this returns a *callable* instance.\n// That’s why it’s documented as a function.\n/**\n * Create a new processor.\n *\n * @example\n * This example shows how a new processor can be created (from `remark`) and linked\n * to **stdin**(4) and **stdout**(4).\n *\n * ```js\n * import process from 'node:process'\n * import concatStream from 'concat-stream'\n * import {remark} from 'remark'\n *\n * process.stdin.pipe(\n * concatStream(function (buf) {\n * process.stdout.write(String(remark().processSync(buf)))\n * })\n * )\n * ```\n *\n * @returns\n * New *unfrozen* processor (`processor`).\n *\n * This processor is configured to work the same as its ancestor.\n * When the descendant processor is configured in the future it does not\n * affect the ancestral processor.\n */\nexport const unified = new Processor().freeze()\n\n/**\n * Assert a parser is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Parser}\n */\nfunction assertParser(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `parser`')\n }\n}\n\n/**\n * Assert a compiler is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Compiler}\n */\nfunction assertCompiler(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `compiler`')\n }\n}\n\n/**\n * Assert the processor is not frozen.\n *\n * @param {string} name\n * @param {unknown} frozen\n * @returns {asserts frozen is false}\n */\nfunction assertUnfrozen(name, frozen) {\n if (frozen) {\n throw new Error(\n 'Cannot call `' +\n name +\n '` on a frozen processor.\\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'\n )\n }\n}\n\n/**\n * Assert `node` is a unist node.\n *\n * @param {unknown} node\n * @returns {asserts node is Node}\n */\nfunction assertNode(node) {\n // `isPlainObj` unfortunately uses `any` instead of `unknown`.\n // type-coverage:ignore-next-line\n if (!isPlainObj(node) || typeof node.type !== 'string') {\n throw new TypeError('Expected node, got `' + node + '`')\n // Fine.\n }\n}\n\n/**\n * Assert that `complete` is `true`.\n *\n * @param {string} name\n * @param {string} asyncName\n * @param {unknown} complete\n * @returns {asserts complete is true}\n */\nfunction assertDone(name, asyncName, complete) {\n if (!complete) {\n throw new Error(\n '`' + name + '` finished async. Use `' + asyncName + '` instead'\n )\n }\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {VFile}\n */\nfunction vfile(value) {\n return looksLikeAVFile(value) ? value : new VFile(value)\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {value is VFile}\n */\nfunction looksLikeAVFile(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'message' in value &&\n 'messages' in value\n )\n}\n\n/**\n * @param {unknown} [value]\n * @returns {value is Value}\n */\nfunction looksLikeAValue(value) {\n return typeof value === 'string' || isUint8Array(value)\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n * thing.\n * @returns {value is Uint8Array}\n * Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'byteLength' in value &&\n 'byteOffset' in value\n )\n}\n","/**\n * Adapter: run a remark-lint rule against the Sätteri mdast tree, return\n * `RuleReport[]`. Mirrors the `zod-adapter` shape — a tiny translation\n * layer that keeps the diagnostic envelope intact while letting us inherit\n * remark-lint's battle-tested detector logic.\n *\n * Why this is safe under the Sätteri constraint: the \"remark plugins\n * no-op\" line in CLAUDE.md describes render-time transforms attached to\n * `markdown.processor`. Lint rules are read-only `(tree, file) => void`\n * functions that walk an mdast and push messages onto a VFile — no\n * mutation, no render-path involvement. Sätteri already gives us a JS\n * mdast tree; we're calling these rules directly on it.\n *\n * Locked to `runSync` so the lint engine stays synchronous (no Promise\n * propagation through `lintFile`).\n */\n\nimport { unified } from \"unified\";\nimport { VFile } from \"vfile\";\n\nimport type { MdRoot } from \"./parse.js\";\nimport type { RuleReport } from \"./rule.js\";\n\n/**\n * Wide plugin shape: each `remark-lint-*` package exports a `Plugin` with\n * different options/tree generics, which TypeScript treats as mutually\n * unassignable to the bare `Plugin` type. The runtime contract is the\n * same — accept settings, walk the tree, push messages on a VFile — so\n * we widen here and forward through the `as never` casts already\n * present in the runtime call.\n */\ntype AnyPlugin = (...args: never[]) => unknown;\n\nexport interface RemarkLintRunOptions {\n /** Source path for the VFile. Used by some rules for context, never\n * displayed by our envelope. */\n path: string;\n /** Full source text. Some remark-lint rules read this for span context. */\n source: string;\n /**\n * Plugin options forwarded to `.use(rule, ...settings)`. Mirrors\n * unified's variadic surface — a single primitive is passed through as\n * one argument; an array is spread (matching how unified parses\n * `[plugin, ...settings]` tuples). Omit when the rule takes no options.\n */\n settings?: unknown[];\n}\n\n/**\n * Run one remark-lint rule (a unified plugin) against an mdast tree and\n * collect its messages as `RuleReport[]`.\n *\n * Each VFileMessage carries `line`/`column`. We use them verbatim and\n * preserve any end-position the rule emits — this is the load-bearing\n * fidelity claim for adopting remark-lint at all. If positions drift on\n * Sätteri's tree vs remark-parse's, that's the empirical question the\n * spike answers.\n */\nexport function runRemarkLintRule(\n rule: AnyPlugin,\n tree: MdRoot,\n opts: RemarkLintRunOptions,\n): RuleReport[] {\n const file = new VFile({ path: opts.path, value: opts.source });\n\n // `runSync` is safe for any rule that's synchronous (every shipped\n // remark-lint rule we adopt should be). If a future rule is async,\n // adopting it would require routing through an async path — flag\n // explicitly rather than silently hide the latency.\n const settings = opts.settings ?? [];\n unified()\n // The `as never` cast lets us forward variadic settings without\n // unified's overload-narrowing fighting us; the runtime call\n // matches unified's documented `use(plugin, ...settings)` shape.\n .use(rule as never, ...settings)\n .runSync(tree as never, file);\n\n return file.messages.map((msg): RuleReport => {\n // `reason` is the canonical message field on VFileMessage; older\n // `message` is the alias. Prefer reason when both are present.\n const message = msg.reason || msg.message || \"\";\n\n // Position: rules attach `place` (newer) or `position` (legacy) for\n // span information. Fall back to the flat `line`/`column` fields.\n const place = (msg as { place?: unknown }).place;\n const span = positionFromPlace(place) ?? positionFromMessage(msg);\n\n return {\n message,\n line: span.line,\n column: span.column,\n endLine: span.endLine,\n endColumn: span.endColumn,\n };\n });\n}\n\ninterface SpanFields {\n line: number;\n column: number;\n endLine?: number;\n endColumn?: number;\n}\n\nfunction positionFromPlace(place: unknown): SpanFields | null {\n if (!place || typeof place !== \"object\") return null;\n const p = place as {\n start?: { line?: number; column?: number };\n end?: { line?: number; column?: number };\n line?: number;\n column?: number;\n };\n // `place` can be either a Point or a Position.\n if (p.start && typeof p.start.line === \"number\" && typeof p.start.column === \"number\") {\n const span: SpanFields = { line: p.start.line, column: p.start.column };\n if (p.end && typeof p.end.line === \"number\" && typeof p.end.column === \"number\") {\n span.endLine = p.end.line;\n span.endColumn = p.end.column;\n }\n return span;\n }\n if (typeof p.line === \"number\" && typeof p.column === \"number\") {\n return { line: p.line, column: p.column };\n }\n return null;\n}\n\nfunction positionFromMessage(msg: {\n line?: number | null;\n column?: number | null;\n}): SpanFields {\n return {\n line: typeof msg.line === \"number\" ? msg.line : 1,\n column: typeof msg.column === \"number\" ? msg.column : 1,\n };\n}\n","/**\n * nimbus/bare-url — a naked external URL in prose reads worse than a\n * descriptive link and is easy to mis-click. Flags `<https://…>`-style\n * autolinks and bare `text === url` links. Not auto-fixed: good link text\n * needs judgment.\n *\n * Detection is delegated to `remark-lint-no-literal-urls` via the\n * adapter.\n */\n\nimport remarkLintNoLiteralUrls from \"remark-lint-no-literal-urls\";\n\nimport { runRemarkLintRule } from \"../remark-lint-adapter.js\";\nimport type { Rule } from \"../rule.js\";\n\nexport const bareUrl: Rule = {\n code: \"nimbus/bare-url\",\n run(ctx) {\n const reports = runRemarkLintRule(\n remarkLintNoLiteralUrls,\n ctx.file.tree,\n { path: ctx.file.path, source: ctx.file.source },\n );\n for (const r of reports) {\n ctx.report({\n ...r,\n message:\n \"bare URL in prose — wrap it in descriptive link text: [what it is](url).\",\n });\n }\n },\n};\n","/**\n * Quote a value.\n *\n * @param value\n * Value(s) to wrap in quotes\n * @param [open='\"']\n * Opening quote\n * @param [close=open]\n * Closing quote\n */\nexport const quotation =\n /**\n * @type {{\n * (value: string, open?: string | null | undefined, close?: string | null | undefined): string\n * (value: ReadonlyArray<string>, open?: string | null | undefined, close?: string | null | undefined): string[]\n * }}\n */\n (\n /**\n * @param {ReadonlyArray<string> | string} value\n * @param {string | null | undefined} open\n * @param {string | null | undefined} close\n * @returns {Array<string> | string}\n */\n function (value, open, close) {\n const start = open || '\"'\n const end = close || start\n let index = -1\n\n if (Array.isArray(value)) {\n const list = /** @type {ReadonlyArray<string>} */ (value)\n /** @type {Array<string>} */\n const result = []\n\n while (++index < list.length) {\n result[index] = start + list[index] + end\n }\n\n return result\n }\n\n if (typeof value === 'string') {\n return start + value + end\n }\n\n throw new TypeError('Expected string or array of strings')\n }\n )\n","/**\n * @typedef {import('mdast').Html} Html\n * @typedef {import('mdast').PhrasingContent} PhrasingContent\n */\n\nimport {convert} from 'unist-util-is'\n\n/**\n * Check if the given value is *phrasing content*.\n *\n * > 👉 **Note**: Excludes `html`, which can be both phrasing or flow.\n *\n * @param node\n * Thing to check, typically `Node`.\n * @returns\n * Whether `value` is phrasing content.\n */\n\nexport const phrasing =\n /** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */\n (\n convert([\n 'break',\n 'delete',\n 'emphasis',\n // To do: next major: removed since footnotes were added to GFM.\n 'footnote',\n 'footnoteReference',\n 'image',\n 'imageReference',\n 'inlineCode',\n // Enabled by `mdast-util-math`:\n 'inlineMath',\n 'link',\n 'linkReference',\n // Enabled by `mdast-util-mdx`:\n 'mdxJsxTextElement',\n // Enabled by `mdast-util-mdx`:\n 'mdxTextExpression',\n 'strong',\n 'text',\n // Enabled by `mdast-util-directive`:\n 'textDirective'\n ])\n )\n","/**\n * remark-lint rule to warn when language flags of fenced code\n * are not used or used incorrectly.\n *\n * ## What is this?\n *\n * This package checks the language flags of fenced code blocks,\n * whether they exist,\n * and optionally what values they hold.\n *\n * Particularly,\n * it provides a check according to GitHub Linguist.\n * Which is what GitHub uses to highlight code.\n * So you can make sure that the language flags you use are recognized by\n * GitHub (or [`starry-night`][github-starry-night])\n *\n * ## When should I use this?\n *\n * You can use this package to check that the style of language flags of fenced\n * code blocks is consistent and known.\n *\n * ## API\n *\n * ### `unified().use(remarkLintFencedCodeFlag[, options])`\n *\n * Warn when language flags of fenced code are not used.\n *\n * ###### Parameters\n *\n * * `options` (`Array<string>`, [`CheckFlag`][api-check-flag], or\n * [`Options`][api-options], optional)\n * — check, configuration, or flags to allow\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * ### `checkGithubLinguistFlag(value)`\n *\n * Check according to GitHub Linguist.\n *\n * ###### Parameters\n *\n * * `value` (`string`)\n * — language flag to check\n *\n * ###### Returns\n *\n * Whether the flag is valid (`undefined`),\n * or a message to warn about (`string`).\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * ### `CheckFlag`\n *\n * Custom check (TypeScript type).\n *\n * ###### Parameters\n *\n * * `value` (`string`)\n * — language flag to check\n *\n * ###### Returns\n *\n * Whether the flag is valid (`undefined`),\n * or a message to warn about (`string`).\n *\n * ### `Options`\n *\n * Configuration (TypeScript type).\n *\n * ###### Fields\n *\n * * `allowEmpty` (`boolean`, default: `false`)\n * — allow language flags to be omitted\n * * `flags` (`Array<string>`, optional)\n * — flags to allow,\n * other flags will result in a warning\n *\n * ## Recommendation\n *\n * While omitting language flags is fine to signal that code is plain text,\n * it *could* point to a mistake.\n * It’s recommended to instead use a certain flag for plain text (such as\n * `txt`) and to turn this rule on.\n * If possible,\n * stick with what is supported by GitHub.\n *\n * [api-check-flag]: #checkflag\n * [api-options]: #options\n * [api-remark-lint-fenced-code-flag]: #unifieduseremarklintfencedcodeflag-options\n * [api-check-github-linguist-flag]: #checkgithublinguistflagvalue\n * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\n * [github-starry-night]: https://github.com/wooorm/starry-night\n *\n * @module fenced-code-flag\n * @author Titus Wormer\n * @copyright Titus Wormer\n * @license MIT\n *\n * @example\n * {\"name\": \"ok.md\"}\n *\n * Some markdown:\n *\n * ```markdown\n * # Mercury\n * ```\n *\n * @example\n * {\"label\": \"input\", \"name\": \"not-ok.md\"}\n *\n * ```\n * mercury()\n * ```\n * @example\n * {\"label\": \"output\", \"name\": \"not-ok.md\"}\n *\n * 1:1-3:4: Unexpected missing fenced code language flag in info string, expected keyword\n *\n * @example\n * {\"config\": {\"allowEmpty\": true}, \"name\": \"ok-allow-empty.md\"}\n *\n * ```\n * mercury()\n * ```\n *\n * @example\n * {\"config\": {\"allowEmpty\": false}, \"label\": \"input\", \"name\": \"not-ok-allow-empty.md\"}\n *\n * ```\n * mercury()\n * ```\n * @example\n * {\"config\": {\"allowEmpty\": false}, \"label\": \"output\", \"name\": \"not-ok-allow-empty.md\"}\n *\n * 1:1-3:4: Unexpected missing fenced code language flag in info string, expected keyword\n *\n * @example\n * {\"config\": [\"markdown\"], \"name\": \"ok-array.md\"}\n *\n * ```markdown\n * # Mercury\n * ```\n *\n * @example\n * {\"config\": {\"flags\":[\"markdown\"]}, \"name\": \"ok-options.md\"}\n *\n * ```markdown\n * # Mercury\n * ```\n *\n * @example\n * {\"config\": [\"markdown\"], \"label\": \"input\", \"name\": \"not-ok-array.md\"}\n *\n * ```javascript\n * mercury()\n * ```\n * @example\n * {\"config\": [\"markdown\"], \"label\": \"output\", \"name\": \"not-ok-array.md\"}\n *\n * 1:1-3:4: Unexpected fenced code language flag `javascript` in info string, expected `markdown`\n *\n * @example\n * {\"config\": [\"javascript\", \"markdown\", \"mdx\", \"typescript\"], \"label\": \"input\", \"name\": \"not-ok-long-array.md\"}\n *\n * ```html\n * <h1>Mercury</h1>\n * ```\n * @example\n * {\"config\": [\"javascript\", \"markdown\", \"mdx\", \"typescript\"], \"label\": \"output\", \"name\": \"not-ok-long-array.md\"}\n *\n * 1:1-3:4: Unexpected fenced code language flag `html` in info string, expected `javascript`, `markdown`, `mdx`, …\n *\n * @example\n * {\"config\": \"🌍\", \"label\": \"output\", \"name\": \"not-ok-options.md\", \"positionless\": true}\n *\n * 1:1: Unexpected value `🌍` for `options`, expected array or object\n */\n\n/**\n * @import {Root} from 'mdast'\n * @import {Info} from './github-linguist-info.js'\n */\n\n/**\n * @callback CheckFlag\n * Custom check.\n * @param {string} value\n * Language flag to check.\n * @returns {string | undefined}\n * Whether the flag is valid (`undefined`),\n * or a message to warn about (`string`).\n *\n * @typedef Options\n * Configuration.\n * @property {boolean | null | undefined} [allowEmpty=false]\n * Allow language flags to be omitted (default: `false`).\n * @property {ReadonlyArray<string> | null | undefined} [flags]\n * Flags to allow,\n * other flags will result in a warning (optional).\n */\n\nimport {quotation} from 'quotation'\nimport {phrasing} from 'mdast-util-phrasing'\nimport {lintRule} from 'unified-lint-rule'\nimport {pointEnd, pointStart} from 'unist-util-position'\nimport {SKIP, visitParents} from 'unist-util-visit-parents'\nimport {githubLinguistInfo} from './github-linguist-info.js'\n\nconst fence = /^ {0,3}([~`])\\1{2,}/\n\nconst listFormat = new Intl.ListFormat('en', {type: 'disjunction'})\nconst listFormatUnit = new Intl.ListFormat('en', {type: 'unit'})\n\nconst remarkLintFencedCodeFlag = lintRule(\n {\n origin: 'remark-lint:fenced-code-flag',\n url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-fenced-code-flag#readme'\n },\n /**\n * @param {Root} tree\n * Tree.\n * @param {CheckFlag | Readonly<Options> | ReadonlyArray<string> | null | undefined} [options]\n * Check, configuration, or flags to allow (optional).\n * @returns {undefined}\n * Nothing.\n */\n function (tree, file, options) {\n const value = String(file)\n /** @type {CheckFlag} */\n let check\n\n if (typeof options === 'function') {\n check = options\n } else if (typeof options === 'object' || options === undefined) {\n check = createCheck(options || {})\n } else {\n file.fail(\n 'Unexpected value `' +\n options +\n '` for `options`, expected array or object'\n )\n }\n\n visitParents(tree, function (node, parents) {\n // Do not walk into phrasing.\n if (phrasing(node)) {\n return SKIP\n }\n\n if (node.type !== 'code') return\n\n const language = node.lang || ''\n const end = pointEnd(node)\n const start = pointStart(node)\n\n if (\n end &&\n start &&\n typeof end.offset === 'number' &&\n typeof start.offset === 'number'\n ) {\n if (language) {\n const reason = check(language)\n if (reason) {\n file.message(reason, {\n ancestors: [...parents, node],\n place: node.position\n })\n }\n }\n // Empty, no flag.\n else {\n const slice = value.slice(start.offset, end.offset)\n\n // To do: next major: indented code shouldn’t be ok either?\n // Then, we can simplify this check.\n if (fence.test(slice)) {\n const reason = check(language)\n\n if (reason) {\n file.message(reason, {\n ancestors: [...parents, node],\n place: node.position\n })\n }\n }\n }\n }\n })\n }\n)\n\nexport default remarkLintFencedCodeFlag\n\n/**\n * @param {Readonly<Options> | ReadonlyArray<string>} options\n * @returns {CheckFlag}\n */\nfunction createCheck(options) {\n let allowEmpty = false\n /** @type {ReadonlyArray<string> | undefined} */\n let allowed\n\n // Note: casts because `isArray` and `readonly` don’t mix.\n if (Array.isArray(options)) {\n const flags = /** @type {ReadonlyArray<string>} */ (options)\n allowed = flags\n } else {\n const settings = /** @type {Options} */ (options)\n allowEmpty = settings.allowEmpty === true\n\n if (settings.flags) {\n allowed = settings.flags\n }\n }\n\n /** @type {string} */\n let allowedDisplay\n\n if (allowed) {\n allowedDisplay =\n allowed.length > 3\n ? listFormatUnit.format([...quotation(allowed.slice(0, 3), '`'), '…'])\n : listFormat.format(quotation(allowed, '`'))\n } else {\n allowedDisplay = 'keyword'\n }\n\n /** @type {CheckFlag} */\n return function (value) {\n if (value) {\n if (allowed && !allowed.includes(value)) {\n return (\n 'Unexpected fenced code language flag `' +\n value +\n '` in info string, expected ' +\n allowedDisplay\n )\n }\n } else if (!allowEmpty) {\n return (\n 'Unexpected missing fenced code language flag in info string, expected ' +\n allowedDisplay\n )\n }\n }\n}\n\n/**\n * Check according to GitHub Linguist.\n *\n * @param {string} value\n * Language flag to check.\n * @returns {string | undefined}\n * Whether the flag is valid (`undefined`),\n * or a message to warn about (`string`).\n * @satisfies {CheckFlag}\n */\nexport function checkGithubLinguistFlag(value) {\n const normal = value\n .toLowerCase()\n .replace(/^[ \\t]+/, '')\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/\\/*[ \\t]*$/g, '')\n\n // Ignore a special flag that is not in linguist so that no highlighting will be applied.\n // `txt` is used by adblock, so that would result in some coloring.\n if (normal === 'text') {\n return\n }\n\n /** @type {Set<Info>} */\n const matches = new Set()\n const dot = normal.lastIndexOf('.')\n let known = false\n\n for (const info of githubLinguistInfo) {\n if (info.names.includes(normal)) {\n // Normalized name found: valid.\n if (value === normal) return\n known = true\n matches.add(info)\n }\n\n if (dot === -1) {\n if (info.extensions && info.extensions.includes('.' + normal)) {\n matches.add(info)\n }\n } else {\n const extension = normal.slice(dot)\n\n if (info.extensions && info.extensions.includes(extension)) {\n matches.add(info)\n }\n\n if (\n info.extensionsWithDot &&\n info.extensionsWithDot.includes(extension)\n ) {\n matches.add(info)\n }\n }\n }\n\n /** @type {Array<string>} */\n const suggestions = []\n\n for (const match of matches) {\n suggestions.push(...match.names)\n }\n\n suggestions.sort()\n\n let allowedDisplay = ''\n\n if (suggestions.length > 0) {\n allowedDisplay =\n ' such as ' +\n (suggestions.length > 5\n ? listFormatUnit.format([\n ...quotation(suggestions.slice(0, 5), '`'),\n '…'\n ])\n : listFormat.format(quotation(suggestions, '`')))\n }\n\n return (\n 'Unexpected ' +\n (known ? '' : 'unknown ') +\n 'fenced code language flag `' +\n value +\n '` in info string, expected a known language name' +\n allowedDisplay\n )\n}\n","/**\n * nimbus/code-block-lang — every fenced code block should declare a\n * language, so syntax highlighting, the copy button, and the language\n * badge all work.\n *\n * Detection is delegated to `remark-lint-fenced-code-flag` via the\n * adapter. `allow?: string[]` is accepted (and round-trips through\n * config) as the forward-compatible hook for validating against a\n * known-language set; today the rule only flags the missing-language\n * case, so any declared language passes.\n */\n\nimport remarkLintFencedCodeFlag from \"remark-lint-fenced-code-flag\";\n\nimport { runRemarkLintRule } from \"../remark-lint-adapter.js\";\nimport type { Rule } from \"../rule.js\";\n\nexport const codeBlockLang: Rule = {\n code: \"nimbus/code-block-lang\",\n run(ctx) {\n const reports = runRemarkLintRule(\n remarkLintFencedCodeFlag,\n ctx.file.tree,\n { path: ctx.file.path, source: ctx.file.source },\n );\n for (const r of reports) {\n ctx.report({\n ...r,\n message:\n 'fenced code block has no language — add one (e.g. ```ts) so highlighting, the copy button, and the language badge render.',\n });\n }\n },\n};\n","/**\n * MDX parsing for the lint engine.\n *\n * Uses Sätteri's own `mdxToMdast` — the *same parser that renders the\n * site* — so the linter never disagrees with what actually ships. No\n * shadow AST, no reintroduced unified pipeline, and the Rust parser keeps\n * the pass fast. Sätteri exposes `mdxToMdast` and unist positions\n * precisely for this kind of read-only inspection; the remark-plugin\n * no-op only affects render-time transforms wired into\n * `markdown.processor`, not direct parse calls like this one.\n */\n\nimport { mdxToMdast } from \"satteri\";\nimport { parse as parseYaml } from \"yaml\";\n\nexport interface Point {\n line: number;\n column: number;\n offset?: number;\n}\n\nexport interface NodePosition {\n start: Point;\n end: Point;\n}\n\n/**\n * A minimal mdast node view. Deliberately structural and dependency-light\n * (no `@types/mdast` coupling) — rules read the handful of fields they\n * need and tolerate the rest.\n */\nexport interface MdNode {\n type: string;\n children?: MdNode[];\n position?: NodePosition;\n value?: string;\n depth?: number;\n lang?: string | null;\n name?: string | null;\n url?: string;\n [key: string]: unknown;\n}\n\nexport interface MdRoot extends MdNode {\n type: \"root\";\n children: MdNode[];\n}\n\nexport interface ParsedFile {\n /** Path relative to the project root, for display. */\n path: string;\n /** Absolute path on disk. */\n absPath: string;\n /** Full source text. */\n source: string;\n /** Source split into lines once, reused by rules + the formatter. */\n lines: string[];\n /** mdast root from Sätteri. */\n tree: MdRoot;\n /** Raw frontmatter body (between the `---` fences), or null when absent. */\n frontmatterRaw: string | null;\n /** 1-based source line the frontmatter body starts on (the line after\n * the opening `---`). */\n frontmatterStartLine: number;\n /** Parsed frontmatter object. `null` when absent or unparseable YAML. */\n frontmatter: Record<string, unknown> | null;\n /** Collection name inferred from the path (`docs`, `partials`, …), or null. */\n collection: string | null;\n /** Set when the MDX body failed to parse (won't render). Rules are\n * skipped; the engine emits a single `nimbus/mdx-syntax` diagnostic. */\n parseError: { message: string; line: number; column: number } | null;\n}\n\n/** Depth-first walk of an mdast tree, visitor called on every node. */\nexport function visit(node: MdNode, visitor: (node: MdNode) => void): void {\n visitor(node);\n if (node.children) {\n for (const child of node.children) visit(child, visitor);\n }\n}\n\n/** Collect every node of a given `type`. */\nexport function collect(root: MdNode, type: string): MdNode[] {\n const out: MdNode[] = [];\n visit(root, (n) => {\n if (n.type === type) out.push(n);\n });\n return out;\n}\n\n/** 1-based start position of a node, falling back to (1,1). */\nexport function startOf(node: MdNode): { line: number; column: number } {\n return {\n line: node.position?.start.line ?? 1,\n column: node.position?.start.column ?? 1,\n };\n}\n\n/** Concatenated text of a node's `text` descendants. */\nexport function textOf(node: MdNode): string {\n let out = \"\";\n visit(node, (n) => {\n if (n.type === \"text\" && typeof n.value === \"string\") out += n.value;\n });\n return out;\n}\n\n/**\n * Find the first node of a given `type` whose start position matches the\n * given 1-based (line, column). Used by remark-lint wrappers to recover\n * the AST node from the rule's reported position so we can compute\n * surgical fixes or dynamic messages.\n *\n * Returns `null` when no matching node exists at that position — a defensive\n * fallback for any future tree-shape drift between remark-parse and Sätteri.\n */\nexport function findNodeAt(\n root: MdNode,\n type: string,\n line: number,\n column: number,\n): MdNode | null {\n let found: MdNode | null = null;\n visit(root, (n) => {\n if (found) return;\n if (n.type !== type) return;\n const start = n.position?.start;\n if (!start) return;\n if (start.line === line && start.column === column) found = n;\n });\n return found;\n}\n\n/**\n * Parse a source string into a `ParsedFile`. `path`/`absPath`/`collection`\n * are caller-supplied; pass-throughs for display and per-collection logic.\n */\nexport function parseSource(\n source: string,\n meta: { path: string; absPath: string; collection: string | null },\n): ParsedFile {\n let tree: MdRoot;\n let parseError: ParsedFile[\"parseError\"] = null;\n try {\n tree = mdxToMdast(source) as unknown as MdRoot;\n } catch (err) {\n // A file that won't parse won't render either — surface it instead of\n // crashing the whole lint run.\n tree = { type: \"root\", children: [] };\n parseError = describeParseError(err, source);\n }\n\n const yamlNode = tree.children.find((n) => n.type === \"yaml\");\n const frontmatterRaw =\n yamlNode && typeof yamlNode.value === \"string\" ? yamlNode.value : null;\n // The yaml node sits on the opening `---`; its body starts the next line.\n const frontmatterStartLine = (yamlNode?.position?.start.line ?? 0) + 1;\n\n let frontmatter: Record<string, unknown> | null = null;\n if (frontmatterRaw !== null) {\n try {\n const parsed = parseYaml(frontmatterRaw);\n frontmatter =\n parsed && typeof parsed === \"object\" && !Array.isArray(parsed)\n ? (parsed as Record<string, unknown>)\n : {};\n } catch {\n frontmatter = null;\n }\n }\n\n return {\n path: meta.path,\n absPath: meta.absPath,\n source,\n lines: source.split(\"\\n\"),\n tree,\n frontmatterRaw,\n frontmatterStartLine,\n frontmatter,\n collection: meta.collection,\n parseError,\n };\n}\n\n/**\n * Turn a Sätteri parse throw into a positioned message. The error text\n * carries a byte offset (`at byte N`); map it to line/column so the\n * diagnostic points at the right spot.\n */\nfunction describeParseError(\n err: unknown,\n source: string,\n): { message: string; line: number; column: number } {\n const message = err instanceof Error ? err.message : String(err);\n const byteMatch = message.match(/at byte (\\d+)/);\n let line = 1;\n let column = 1;\n if (byteMatch) {\n const byteOffset = Number(byteMatch[1]);\n const prefix = Buffer.from(source, \"utf8\")\n .subarray(0, byteOffset)\n .toString(\"utf8\");\n const prefixLines = prefix.split(\"\\n\");\n line = prefixLines.length;\n column = (prefixLines[prefixLines.length - 1]?.length ?? 0) + 1;\n }\n return { message, line, column };\n}\n","/**\n * nimbus/code-block-prompt-prefix — shell snippets that prefix commands\n * with \"$ \" break copy-paste: readers copy the prompt too. Flags shell\n * code blocks containing prompt-prefixed lines. Reported per block (the\n * fix spans many lines, so it's left to the author / a future --fix).\n */\n\nimport { collect, startOf } from \"../parse.js\";\nimport type { Rule } from \"../rule.js\";\n\nconst SHELL_LANGS = new Set([\n \"bash\",\n \"sh\",\n \"shell\",\n \"zsh\",\n \"console\",\n \"shellsession\",\n]);\n\nexport const codeBlockPromptPrefix: Rule = {\n code: \"nimbus/code-block-prompt-prefix\",\n run(ctx) {\n for (const block of collect(ctx.file.tree, \"code\")) {\n const lang = typeof block.lang === \"string\" ? block.lang.toLowerCase() : \"\";\n if (!SHELL_LANGS.has(lang)) continue;\n const value = typeof block.value === \"string\" ? block.value : \"\";\n const hasPrompt = value.split(\"\\n\").some((line) => /^\\s*\\$\\s+\\S/.test(line));\n if (!hasPrompt) continue;\n\n const at = startOf(block);\n ctx.report({\n message:\n 'shell block prefixes commands with \"$ \" — drop the prompt so readers can copy-paste the commands directly.',\n line: at.line,\n column: at.column,\n });\n }\n },\n};\n","/**\n * nimbus/description-required — every page needs a non-empty `description`.\n *\n * Distinct from `frontmatter-shape`: the framework schema marks\n * `description` as optional (so it doesn't fail the build), but a missing\n * description hurts SEO and agent indexing — a quality opinion the lint\n * carries.\n *\n * Partials are typically embedded fragments rather than pages, so projects\n * usually want to exempt them. That exemption is **configured**, not\n * hardcoded — use `collections.partials.rules: { \"nimbus/description-required\":\n * \"off\" }` in `nimbus(config, …)`. The rule itself stays collection-agnostic\n * so per-collection overrides can opt in or out per project.\n *\n * Not auto-fixable: a good description needs judgment, so the guidance\n * lives in the message rather than a synthesized `fix`.\n */\n\nimport type { Rule } from \"../rule.js\";\n\nexport const descriptionRequired: Rule = {\n code: \"nimbus/description-required\",\n run(ctx) {\n const frontmatter = ctx.file.frontmatter;\n // The unparseable / absent-YAML case belongs to frontmatter-shape.\n if (frontmatter === null) return;\n\n const description = frontmatter.description;\n if (typeof description !== \"string\" || description.trim() === \"\") {\n ctx.report({\n message:\n 'missing a non-empty \"description\" — add a one-sentence summary used for SEO meta tags and agent indexing.',\n line: ctx.file.frontmatterStartLine,\n column: 1,\n });\n }\n },\n};\n","/**\n * remark-lint rule to warn when the same text is used in multiple headings.\n *\n * ## What is this?\n *\n * This package checks that headings are unique.\n *\n * ## When should I use this?\n *\n * You can use this package to check that headings are unique.\n *\n * ## API\n *\n * ### `unified().use(remarkLintNoDuplicateHeadings)`\n *\n * Warn when the same text is used in multiple headings.\n *\n * ###### Parameters\n *\n * There are no options.\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * ## Recommendation\n *\n * Headings having unique text helps screen reader users,\n * who typically use “jump to heading” features to navigate within a page,\n * which reads headings out loud.\n *\n * It also helps because often headings receive automatic unique IDs,\n * and when the same heading text is used,\n * they are suffixed with a number based on where they are positioned in the\n * document,\n * which makes linking to them prone to changes.\n *\n * [api-remark-lint-no-duplicate-headings]: #unifieduseremarklintnoduplicateheadings\n * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\n *\n * @module no-duplicate-headings\n * @author Titus Wormer\n * @copyright Titus Wormer\n * @license MIT\n *\n * @example\n * {\"name\": \"ok.md\"}\n *\n * # Mercury\n *\n * ## Venus\n *\n * @example\n * {\"label\": \"input\", \"name\": \"not-ok.md\"}\n *\n * # Mercury\n *\n * ## Mercury\n *\n * ## [Mercury](https://example.com/mercury/)\n * @example\n * {\"label\": \"output\", \"name\": \"not-ok.md\"}\n *\n * 3:1-3:11: Unexpected heading with equivalent text, expected unique headings\n * 5:1-5:43: Unexpected heading with equivalent text, expected unique headings\n *\n * @example\n * {\"label\": \"input\", \"mdx\": true, \"name\": \"mdx.mdx\"}\n *\n * <h1>Mercury</h1>\n * <h2>Mercury</h2>\n * @example\n * {\"label\": \"output\", \"mdx\": true, \"name\": \"mdx.mdx\"}\n *\n * 2:1-2:17: Unexpected heading with equivalent text, expected unique headings\n */\n\n/**\n * @import {Nodes, Root} from 'mdast'\n * @import {} from 'mdast-util-mdx'\n */\n\nimport {ok as assert} from 'devlop'\nimport {toString} from 'mdast-util-to-string'\nimport {lintRule} from 'unified-lint-rule'\nimport {visitParents} from 'unist-util-visit-parents'\nimport {VFileMessage} from 'vfile-message'\n\nconst jsxNameRe = /^h([1-6])$/\n\nconst remarkLintNoDuplicateHeadings = lintRule(\n {\n origin: 'remark-lint:no-duplicate-headings',\n url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-duplicate-headings#readme'\n },\n /**\n * @param {Root} tree\n * Tree.\n * @returns {undefined}\n * Nothing.\n */\n function (tree, file) {\n /** @type {Map<string, Array<Nodes>>} */\n const map = new Map()\n\n visitParents(tree, function (node, parents) {\n if (\n node.type === 'heading' ||\n ((node.type === 'mdxJsxFlowElement' ||\n node.type === 'mdxJsxTextElement') &&\n node.name &&\n jsxNameRe.test(node.name))\n ) {\n const ancestors = [...parents, node]\n const value = toString(node).toLowerCase()\n const duplicateAncestors = map.get(value)\n\n if (node.position && duplicateAncestors) {\n const duplicate = duplicateAncestors.at(-1)\n assert(duplicate) // Always defined.\n\n file.message(\n 'Unexpected heading with equivalent text, expected unique headings',\n {\n ancestors,\n cause: new VFileMessage('Equivalent heading text defined here', {\n ancestors: duplicateAncestors,\n place: duplicate.position,\n source: 'remark-lint',\n ruleId: 'no-duplicate-headings'\n }),\n place: node.position\n }\n )\n }\n\n map.set(value, ancestors)\n }\n })\n }\n)\n\nexport default remarkLintNoDuplicateHeadings\n","/**\n * nimbus/duplicate-heading-text — two headings with the same text generate\n * colliding anchor slugs, so deep links land on the wrong one. Reports the\n * second (and later) occurrence. Not auto-fixable — renaming needs\n * judgment.\n *\n * Detection is delegated to `remark-lint-no-duplicate-headings` via the\n * adapter. The wrapper re-walks the tree at each reported position to\n * recover the duplicate heading's text (and the first occurrence's line)\n * for the message — the dynamic info matters for navigability.\n */\n\nimport remarkLintNoDuplicateHeadings from \"remark-lint-no-duplicate-headings\";\n\nimport { collect, findNodeAt, startOf, textOf } from \"../parse.js\";\nimport { runRemarkLintRule } from \"../remark-lint-adapter.js\";\nimport type { Rule } from \"../rule.js\";\n\nexport const duplicateHeadingText: Rule = {\n code: \"nimbus/duplicate-heading-text\",\n run(ctx) {\n const reports = runRemarkLintRule(\n remarkLintNoDuplicateHeadings,\n ctx.file.tree,\n { path: ctx.file.path, source: ctx.file.source },\n );\n\n if (reports.length === 0) return;\n\n // Build a map of normalized heading text → first occurrence line so\n // we can reproduce the \"(first used on line N)\" hint the\n // hand-rolled rule emitted.\n const firstSeen = new Map<string, number>();\n for (const heading of collect(ctx.file.tree, \"heading\")) {\n const key = textOf(heading).trim().toLowerCase();\n if (key === \"\") continue;\n if (!firstSeen.has(key)) firstSeen.set(key, startOf(heading).line);\n }\n\n for (const r of reports) {\n const heading = findNodeAt(ctx.file.tree, \"heading\", r.line, r.column);\n if (!heading) {\n ctx.report({\n ...r,\n message:\n \"duplicate heading text — duplicate headings produce colliding anchor links.\",\n });\n continue;\n }\n const text = textOf(heading).trim();\n const first = firstSeen.get(text.toLowerCase());\n ctx.report({\n ...r,\n message:\n first !== undefined && first !== r.line\n ? `duplicate heading \"${text}\" (first used on line ${first}) — duplicate headings produce colliding anchor links.`\n : `duplicate heading \"${text}\" — duplicate headings produce colliding anchor links.`,\n });\n }\n },\n};\n","/**\n * remark-lint rule to warn when emphasis markers are inconsistent.\n *\n * ## What is this?\n *\n * This package checks the style of emphasis markers.\n *\n * ## When should I use this?\n *\n * You can use this package to check that emphasis is consistent.\n *\n * ## API\n *\n * ### `unified().use(remarkLintEmphasisMarker[, options])`\n *\n * Warn when emphasis markers are inconsistent.\n *\n * ###### Parameters\n *\n * * `options` ([`Options`][api-options], default: `'consistent'`)\n * — preferred style or whether to detect the first style and warn for\n * further differences\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * ### `Marker`\n *\n * Marker (TypeScript type).\n *\n * ###### Type\n *\n * ```ts\n * type Marker = '*' | '_'\n * ```\n *\n * ### `Options`\n *\n * Configuration (TypeScript type).\n *\n * ###### Type\n *\n * ```ts\n * type Options = Marker | 'consistent'\n * ```\n *\n * ## Recommendation\n *\n * Whether asterisks or underscores are used affects how and whether emphasis\n * works.\n * Underscores are sometimes used to represent normal underscores inside words,\n * so there are extra rules in markdown to support that.\n * Asterisks are not used in natural language,\n * so they don’t need these rules,\n * and thus can form emphasis in more cases.\n * Asterisks can also be used as the marker of more constructs than underscores:\n * lists.\n * Due to having simpler parsing rules,\n * looking more like syntax,\n * and that they can be used for more constructs,\n * it’s recommended to prefer asterisks.\n *\n * ## Fix\n *\n * [`remark-stringify`][github-remark-stringify] formats emphasis with\n * asterisks by default.\n * Pass `emphasis: '_'` to always use underscores.\n *\n * [api-marker]: #marker\n * [api-options]: #options\n * [api-remark-lint-emphasis-marker]: #unifieduseremarklintemphasismarker-options\n * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify\n * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\n *\n * @module emphasis-marker\n * @author Titus Wormer\n * @copyright Titus Wormer\n * @license MIT\n *\n * @example\n * {\"config\": \"*\", \"name\": \"ok-asterisk.md\"}\n *\n * *Mercury*.\n *\n * @example\n * {\"config\": \"*\", \"label\": \"input\", \"name\": \"not-ok-asterisk.md\"}\n *\n * _Mercury_.\n *\n * @example\n * {\"config\": \"*\", \"label\": \"output\", \"name\": \"not-ok-asterisk.md\"}\n *\n * 1:1-1:10: Unexpected emphasis marker `_`, expected `*`\n *\n * @example\n * {\"config\": \"_\", \"name\": \"ok-underscore.md\"}\n *\n * _Mercury_.\n *\n * @example\n * {\"config\": \"_\", \"label\": \"input\", \"name\": \"not-ok-underscore.md\"}\n *\n * *Mercury*.\n *\n * @example\n * {\"config\": \"_\", \"label\": \"output\", \"name\": \"not-ok-underscore.md\"}\n *\n * 1:1-1:10: Unexpected emphasis marker `*`, expected `_`\n *\n * @example\n * {\"label\": \"input\", \"name\": \"not-ok-consistent.md\"}\n *\n * *Mercury* and _Venus_.\n *\n * @example\n * {\"label\": \"output\", \"name\": \"not-ok-consistent.md\"}\n *\n * 1:15-1:22: Unexpected emphasis marker `_`, expected `*`\n *\n * @example\n * {\"config\": \"🌍\", \"label\": \"output\", \"name\": \"not-ok.md\", \"positionless\": true}\n *\n * 1:1: Unexpected value `🌍` for `options`, expected `'*'`, `'_'`, or `'consistent'`\n */\n\n/**\n * @import {Root} from 'mdast'\n */\n\n/**\n * @typedef {'*' | '_'} Marker\n * Styles.\n *\n * @typedef {Marker | 'consistent'} Options\n * Configuration.\n */\n\nimport {lintRule} from 'unified-lint-rule'\nimport {pointStart} from 'unist-util-position'\nimport {visitParents} from 'unist-util-visit-parents'\nimport {VFileMessage} from 'vfile-message'\n\nconst remarkLintEmphasisMarker = lintRule(\n {\n origin: 'remark-lint:emphasis-marker',\n url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-emphasis-marker#readme'\n },\n /**\n * @param {Root} tree\n * Tree.\n * @param {Options | null | undefined} [options='consistent']\n * Configuration (default: `'consistent`').\n * @returns {undefined}\n * Nothing.\n */\n function (tree, file, options) {\n const value = String(file)\n /** @type {VFileMessage | undefined} */\n let cause\n /** @type {Marker | undefined} */\n let expected\n\n if (options === null || options === undefined || options === 'consistent') {\n // Empty.\n } else if (options === '*' || options === '_') {\n expected = options\n } else {\n file.fail(\n 'Unexpected value `' +\n options +\n \"` for `options`, expected `'*'`, `'_'`, or `'consistent'`\"\n )\n }\n\n visitParents(tree, 'emphasis', function (node, parents) {\n const start = pointStart(node)\n\n if (start && typeof start.offset === 'number') {\n const actual = value.charAt(start.offset)\n\n /* c8 ignore next -- should not happen. */\n if (actual !== '*' && actual !== '_') return\n\n if (expected) {\n if (actual !== expected) {\n file.message(\n 'Unexpected emphasis marker `' +\n actual +\n '`, expected `' +\n expected +\n '`',\n {ancestors: [...parents, node], cause, place: node.position}\n )\n }\n } else {\n expected = actual\n cause = new VFileMessage(\n \"Emphasis marker style `'\" +\n actual +\n \"'` first defined for `'consistent'` here\",\n {\n ancestors: [...parents, node],\n place: node.position,\n ruleId: 'emphasis-marker',\n source: 'remark-lint'\n }\n )\n }\n }\n })\n }\n)\n\nexport default remarkLintEmphasisMarker\n","/**\n * nimbus/emphasis-style — consistent italic delimiter. `style?:\n * \"asterisk\" | \"underscore\"` (default `asterisk`). Auto-fixable: swap both\n * delimiters. Targets italic (`emphasis`); bold (`strong`) is left alone.\n *\n * Detection is delegated to `remark-lint-emphasis-marker` via the\n * adapter (configured with the chosen marker). The wrapper re-walks the\n * tree at each reported position to recover both delimiter offsets for\n * the two-edit surgical fix.\n */\n\nimport remarkLintEmphasisMarker from \"remark-lint-emphasis-marker\";\n\nimport { findNodeAt } from \"../parse.js\";\nimport { runRemarkLintRule } from \"../remark-lint-adapter.js\";\nimport type { Rule } from \"../rule.js\";\n\nconst DELIM = { asterisk: \"*\", underscore: \"_\" } as const;\n\nexport const emphasisStyle: Rule = {\n code: \"nimbus/emphasis-style\",\n run(ctx) {\n const style = ctx.options.style === \"underscore\" ? \"underscore\" : \"asterisk\";\n const want = DELIM[style];\n\n const reports = runRemarkLintRule(\n remarkLintEmphasisMarker,\n ctx.file.tree,\n {\n path: ctx.file.path,\n source: ctx.file.source,\n settings: [want],\n },\n );\n\n for (const r of reports) {\n const node = findNodeAt(ctx.file.tree, \"emphasis\", r.line, r.column);\n const start = node?.position?.start.offset;\n const end = node?.position?.end.offset;\n if (typeof start !== \"number\" || typeof end !== \"number\") {\n ctx.report({\n ...r,\n message: `italic delimiter should be \"${want}\".`,\n });\n continue;\n }\n const open = ctx.file.source[start];\n if (open !== \"_\" && open !== \"*\") {\n ctx.report({\n ...r,\n message: `italic delimiter should be \"${want}\".`,\n });\n continue;\n }\n\n ctx.report({\n ...r,\n message: `italic uses \"${open}…${open}\" — this project's emphasis marker is \"${want}\".`,\n fix: {\n description: `change the \"${open}\" delimiters to \"${want}\"`,\n edits: [\n { range: [start, start + 1], text: want },\n { range: [end - 1, end], text: want },\n ],\n },\n });\n }\n },\n};\n","/**\n * Adapter: a Zod error → `RuleReport[]`, with each issue mapped onto the\n * line of the offending frontmatter key. Consumed by\n * `nimbus/frontmatter-shape`; kept separate so any future rule that\n * validates structured data through Zod can route through the same shape.\n *\n * Typed structurally against the ZodError surface we use (just `issues`)\n * so it doesn't pin a specific `astro/zod` version.\n */\n\nimport type { RuleReport } from \"./rule.js\";\n\ninterface ZodIssueLike {\n path: ReadonlyArray<PropertyKey>;\n message: string;\n}\n\ninterface ZodErrorLike {\n issues: ReadonlyArray<ZodIssueLike>;\n}\n\n/**\n * Convert each Zod issue into a report. The position is resolved by\n * locating the top-level frontmatter key in the raw YAML; falls back to\n * the first frontmatter line when the key can't be found (e.g. a missing\n * required field, or a nested path whose root key was omitted).\n */\nexport function zodErrorToReports(\n error: ZodErrorLike,\n opts: { frontmatterRaw: string; frontmatterStartLine: number },\n): RuleReport[] {\n return error.issues.map((issue) => {\n const dottedPath = issue.path\n .filter((p): p is string | number => typeof p !== \"symbol\")\n .join(\".\");\n const rootKey = issue.path.find((p): p is string => typeof p === \"string\");\n const { line, column } = locateKey(\n opts.frontmatterRaw,\n rootKey,\n opts.frontmatterStartLine,\n );\n const label = dottedPath.length > 0 ? dottedPath : \"(frontmatter)\";\n return { message: `${label}: ${issue.message}`, line, column };\n });\n}\n\n/**\n * Find the 1-based source line/column of a top-level YAML key. The column\n * points at the start of the key. Returns the frontmatter's first line at\n * column 1 when the key isn't present.\n */\nfunction locateKey(\n frontmatterRaw: string,\n key: string | undefined,\n startLine: number,\n): { line: number; column: number } {\n if (key) {\n const rawLines = frontmatterRaw.split(\"\\n\");\n const pattern = new RegExp(`^(\\\\s*)${escapeRegExp(key)}\\\\s*:`);\n for (let i = 0; i < rawLines.length; i++) {\n const match = rawLines[i]!.match(pattern);\n if (match) {\n return { line: startLine + i, column: match[1]!.length + 1 };\n }\n }\n }\n return { line: startLine, column: 1 };\n}\n\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n","/**\n * nimbus/frontmatter-shape — validate frontmatter against the framework's\n * content schema via the Zod-to-diagnostic adapter.\n *\n * Runs in *lenient* (passthrough) mode: it checks the types of the fields\n * Nimbus owns (title is a string, draft is a boolean, sidebar.order is a\n * number, …) but tolerates user-added fields, because the standalone CLI\n * can't yet see a site's extended `content.config.ts` schema. Lint\n * directive keys (`nimbusDisableRules`) are stripped before validation —\n * they're tooling, not content.\n */\n\nimport { lenientDocsSchema, lenientPartialsSchema } from \"../../schemas.js\";\nimport type { Rule } from \"../rule.js\";\nimport { zodErrorToReports } from \"../zod-adapter.js\";\n\nconst LINT_DIRECTIVE_KEYS = [\"nimbusDisableRules\"];\n\nexport const frontmatterShape: Rule = {\n code: \"nimbus/frontmatter-shape\",\n run(ctx) {\n const { frontmatter, frontmatterRaw, frontmatterStartLine } = ctx.file;\n\n // Raw frontmatter present but YAML parse failed — report that, since\n // every downstream check depends on a parseable object.\n if (frontmatter === null) {\n if (frontmatterRaw !== null) {\n ctx.report({\n message: \"frontmatter is present but is not valid YAML.\",\n line: frontmatterStartLine,\n column: 1,\n });\n }\n return;\n }\n\n const subject: Record<string, unknown> = { ...frontmatter };\n for (const key of LINT_DIRECTIVE_KEYS) delete subject[key];\n\n const schema =\n ctx.file.collection === \"partials\"\n ? lenientPartialsSchema\n : lenientDocsSchema;\n\n const result = schema.safeParse(subject);\n if (!result.success) {\n const reports = zodErrorToReports(result.error, {\n frontmatterRaw: frontmatterRaw ?? \"\",\n frontmatterStartLine,\n });\n for (const report of reports) ctx.report(report);\n }\n },\n};\n","/**\n * remark-lint rule to warn when heading ranks increment with more than\n * 1 at a time.\n *\n * ## What is this?\n *\n * This package checks the increase of headings.\n *\n * ## When should I use this?\n *\n * You can use this package to check the increase of headings.\n *\n * ## API\n *\n * ### `unified().use(remarkLintHeadingIncrement)`\n *\n * Warn when heading ranks increment with more than 1 at a time.\n *\n * ###### Parameters\n *\n * There are no options.\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * ## Recommendation\n *\n * While markdown is not only used for HTML,\n * HTML accessibility guidelines state that headings should increment by one at\n * a time.\n * As in,\n * say the previous heading had a rank of 2 (so `<h2>`),\n * then the following heading that is to be considered “inside” it should have\n * a rank of 3 (`<h3>`).\n * Due to this,\n * when HTML output is a goal of the document,\n * it’s recommended that this rule is turned on.\n *\n * [api-remark-lint-heading-increment]: #unifieduseremarklintheadingincrement\n * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\n *\n * @module heading-increment\n * @author Titus Wormer\n * @copyright Titus Wormer\n * @license MIT\n *\n * @example\n * {\"name\": \"ok.md\"}\n *\n * # Mercury\n *\n * ## Nomenclature\n *\n * @example\n * {\"name\": \"also-ok.md\"}\n *\n * #### Impact basins and craters\n *\n * #### Plains\n *\n * #### Compressional features\n *\n * @example\n * {\"label\": \"input\", \"name\": \"not-ok.md\"}\n *\n * # Mercury\n *\n * ### Internal structure\n *\n * ### Surface geology\n *\n * ## Observation history\n *\n * #### Mariner 10\n *\n * @example\n * {\"label\": \"output\", \"name\": \"not-ok.md\"}\n *\n * 3:1-3:23: Unexpected heading rank `3`, exected rank `2`\n * 5:1-5:20: Unexpected heading rank `3`, exected rank `2`\n * 9:1-9:16: Unexpected heading rank `4`, exected rank `3`\n *\n * @example\n * {\"label\": \"input\", \"name\": \"html.md\"}\n *\n * # Mercury\n *\n * <b>Mercury</b> is the first planet from the Sun and the smallest\n * in the Solar System.\n *\n * <h3>Internal structure</h3>\n *\n * <h2>Orbit, rotation, and longitude</h2>\n * @example\n * {\"label\": \"output\", \"name\": \"html.md\"}\n *\n * 6:1-6:28: Unexpected heading rank `3`, exected rank `2`\n *\n * @example\n * {\"mdx\": true, \"name\": \"mdx.mdx\"}\n *\n * # Mercury\n *\n * <b>Mercury</b> is the first planet from the Sun and the smallest\n * in the Solar System.\n *\n * <h3>Internal structure</h3>\n *\n * <h2>Orbit, rotation, and longitude</h2>\n * @example\n * {\"label\": \"output\", \"mdx\": true, \"name\": \"mdx.mdx\"}\n *\n * 6:1-6:28: Unexpected heading rank `3`, exected rank `2`\n */\n\n/**\n * @import {Heading, Nodes, Root} from 'mdast'\n * @import {} from 'mdast-util-mdx'\n */\n\nimport {ok as assert} from 'devlop'\nimport {lintRule} from 'unified-lint-rule'\nimport {visitParents} from 'unist-util-visit-parents'\nimport {VFileMessage} from 'vfile-message'\n\nconst htmlRe = /<h([1-6])/\nconst jsxNameRe = /^h([1-6])$/\n\nconst remarkLintHeadingIncrement = lintRule(\n {\n origin: 'remark-lint:heading-increment',\n url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-heading-increment#readme'\n },\n /**\n * @param {Root} tree\n * Tree.\n * @returns {undefined}\n * Nothing.\n */\n function (tree, file) {\n /** @type {Array<Array<Nodes> | undefined>} */\n const stack = []\n\n visitParents(tree, function (node, parents) {\n const rank = inferRank(node)\n\n if (rank) {\n let index = rank\n /** @type {Array<Nodes> | undefined} */\n let closestAncestors\n\n while (index--) {\n if (stack[index]) {\n closestAncestors = stack[index]\n break\n }\n }\n\n if (closestAncestors) {\n const parent = closestAncestors.at(-1)\n assert(parent) // Always defined.\n const parentRank = inferRank(parent)\n assert(parentRank) // Always defined.\n\n if (node.position && rank > parentRank + 1) {\n file.message(\n 'Unexpected heading rank `' +\n rank +\n '`, exected rank `' +\n (parentRank + 1) +\n '`',\n {\n ancestors: [...parents, node],\n cause: new VFileMessage('Parent heading defined here', {\n ancestors: closestAncestors,\n place: parent.position,\n source: 'remark-lint',\n ruleId: 'heading-increment'\n }),\n place: node.position\n }\n )\n }\n }\n\n stack[rank] = [...parents, node]\n // Drop things after it.\n stack.length = rank + 1\n }\n })\n }\n)\n\nexport default remarkLintHeadingIncrement\n\n/**\n * Get rank of a node.\n *\n * @param {Nodes} node\n * Node.\n * @returns {Heading['depth'] | undefined}\n * Rank, if heading.\n */\nfunction inferRank(node) {\n /** @type {Heading['depth'] | undefined} */\n let rank\n\n if (node.type === 'heading') {\n rank = node.depth\n } else if (node.type === 'html') {\n const results = node.value.match(htmlRe)\n rank = results\n ? /** @type {Heading['depth']} */ (Number(results[1]))\n : undefined\n } else if (\n (node.type === 'mdxJsxFlowElement' || node.type === 'mdxJsxTextElement') &&\n node.name\n ) {\n const results = node.name.match(jsxNameRe)\n rank = results\n ? /** @type {Heading['depth']} */ (Number(results[1]))\n : undefined\n }\n\n return rank\n}\n","/**\n * nimbus/heading-hierarchy — headings shouldn't skip levels. Going from an\n * H2 straight to an H4 breaks the document outline (and screen-reader\n * navigation). Reports the heading that does the skipping.\n *\n * Detection is delegated to `remark-lint-heading-increment` via the\n * adapter. The wrapper re-walks the tree at each reported position to\n * find the offending heading and its predecessor, then constructs the\n * dynamic message (\"h2 to h4 — use h3 instead\") the hand-rolled rule\n * emitted.\n */\n\nimport remarkLintHeadingIncrement from \"remark-lint-heading-increment\";\n\nimport { collect } from \"../parse.js\";\nimport { runRemarkLintRule } from \"../remark-lint-adapter.js\";\nimport type { Rule } from \"../rule.js\";\n\nexport const headingHierarchy: Rule = {\n code: \"nimbus/heading-hierarchy\",\n run(ctx) {\n const reports = runRemarkLintRule(\n remarkLintHeadingIncrement,\n ctx.file.tree,\n { path: ctx.file.path, source: ctx.file.source },\n );\n\n if (reports.length === 0) return;\n\n const headings = collect(ctx.file.tree, \"heading\");\n\n for (const r of reports) {\n const idx = headings.findIndex((h) => {\n const p = h.position?.start;\n return p?.line === r.line && p?.column === r.column;\n });\n\n if (idx <= 0) {\n // Defensive: no predecessor (or position drifted) — fall back to\n // a static message rather than misreport the levels.\n ctx.report({\n ...r,\n message:\n \"heading level skips — don't jump past a level. Insert the missing depth instead.\",\n });\n continue;\n }\n\n const prevDepth = headings[idx - 1]!.depth ?? 1;\n const curDepth = headings[idx]!.depth ?? 1;\n ctx.report({\n ...r,\n message: `heading level jumps from h${prevDepth} to h${curDepth} — don't skip levels; use h${prevDepth + 1} instead.`,\n });\n }\n },\n};\n","/**\n * remark-lint rule to warn when headings end in irregular characters.\n *\n * ## What is this?\n *\n * This package checks heading text.\n *\n * ## When should I use this?\n *\n * You can use this package to check that heading text is consistent.\n *\n * ## API\n *\n * ### `unified().use(remarkLintNoHeadingPunctuation[, options])`\n *\n * Warn when headings end in irregular characters.\n *\n * ###### Parameters\n *\n * * `options` (`RegExp` or `string`, default: `/[!,.:;?]/u`)\n * — configuration,\n * when string wrapped in `new RegExp('[' + x + ']', 'u')` so make sure to\n * escape regexp characters\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * [api-remark-lint-no-heading-punctuation]: #unifieduseremarklintnoheadingpunctuation-options\n * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\n *\n * @module no-heading-punctuation\n * @author Titus Wormer\n * @copyright Titus Wormer\n * @license MIT\n *\n * @example\n * {\"name\": \"ok.md\"}\n *\n * # Mercury\n *\n * @example\n * {\"label\": \"input\", \"name\": \"not-ok.md\"}\n *\n * # Mercury:\n *\n * # Venus?\n *\n * # Earth!\n *\n * # Mars,\n *\n * # Jupiter;\n * @example\n * {\"label\": \"output\", \"name\": \"not-ok.md\"}\n *\n * 1:1-1:11: Unexpected character `:` at end of heading, remove it\n * 3:1-3:9: Unexpected character `?` at end of heading, remove it\n * 5:1-5:9: Unexpected character `!` at end of heading, remove it\n * 7:1-7:8: Unexpected character `,` at end of heading, remove it\n * 9:1-9:11: Unexpected character `;` at end of heading, remove it\n *\n * @example\n * {\"config\": \",;:!?\", \"name\": \"ok.md\"}\n *\n * # Mercury…\n *\n * @example\n * {\"config\": {\"source\": \"[^A-Za-z0-9]\"}, \"label\": \"input\", \"name\": \"regex.md\"}\n *\n * # Mercury!\n * @example\n * {\"config\": {\"source\": \"[^A-Za-z0-9]\"}, \"label\": \"output\", \"name\": \"regex.md\"}\n *\n * 1:1-1:11: Unexpected character `!` at end of heading, remove it\n *\n * @example\n * {\"label\": \"input\", \"mdx\": true, \"name\": \"example.mdx\"}\n *\n * <h1>Mercury?</h1>\n * @example\n * {\"label\": \"output\", \"mdx\": true, \"name\": \"example.mdx\"}\n *\n * 1:1-1:18: Unexpected character `?` at end of heading, remove it\n *\n * @example\n * {\"config\": 1, \"label\": \"output\", \"name\": \"not-ok-options.md\", \"positionless\": true}\n *\n * 1:1: Unexpected value `1` for `options`, expected `RegExp` or `string`\n */\n\n/**\n * @import {Root} from 'mdast'\n * @import {} from 'mdast-util-mdx'\n */\n\nimport {toString} from 'mdast-util-to-string'\nimport {lintRule} from 'unified-lint-rule'\nimport {visitParents} from 'unist-util-visit-parents'\n\nconst jsxNameRe = /^h([1-6])$/\nconst defaultExpression = /[!,.:;?]/u\n\nconst remarkLintNoHeadingPunctuation = lintRule(\n {\n origin: 'remark-lint:no-heading-punctuation',\n url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-heading-punctuation#readme'\n },\n /**\n * @param {Root} tree\n * Tree.\n * @param {RegExp | string | null | undefined} [options]\n * Configuration (default: `/[!,.:;?]/u`),\n * wrapped in `new RegExp('[' + x + ']', 'u')` so make sure to double escape\n * regexp characters.\n * @returns {undefined}\n * Nothing.\n */\n function (tree, file, options) {\n let expected = defaultExpression\n\n if (options === null || options === undefined) {\n // Empty.\n } else if (typeof options === 'string') {\n expected = new RegExp('[' + options + ']', 'u')\n } else if (typeof options === 'object' && 'source' in options) {\n expected = new RegExp(options.source, options.flags ?? 'u')\n } else {\n file.fail(\n 'Unexpected value `' +\n options +\n '` for `options`, expected `RegExp` or `string`'\n )\n }\n\n visitParents(tree, function (node, parents) {\n if (\n node.position && // Plain markdown.\n (node.type === 'heading' ||\n // MDX JSX.\n ((node.type === 'mdxJsxFlowElement' ||\n node.type === 'mdxJsxTextElement') &&\n node.name &&\n jsxNameRe.test(node.name)))\n ) {\n const tail = Array.from(toString(node)).at(-1)\n\n if (tail && expected.test(tail)) {\n file.message(\n 'Unexpected character `' + tail + '` at end of heading, remove it',\n {ancestors: [...parents, node], place: node.position}\n )\n }\n }\n })\n }\n)\n\nexport default remarkLintNoHeadingPunctuation\n","/**\n * nimbus/heading-punctuation — headings shouldn't end in trailing\n * punctuation (`.`, `,`, `:`, `;`, `!`). Question marks are allowed —\n * \"How do I…?\" is a legitimate heading. Auto-fixable: strip the trailing\n * punctuation.\n *\n * Detection is delegated to `remark-lint-no-heading-punctuation` via the\n * adapter. The plugin's default disallowed set is `.,;:!?`; we override\n * with `.,;:!` so `?` headings stay legitimate — the policy lives in the\n * plugin's options, not in a post-filter that would silently mask any\n * future detection improvement.\n *\n * The wrapper re-walks the tree at each reported position to recover the\n * heading node, then builds the dynamic message (which names the trailing\n * punct) and the surgical fix (which strips it).\n */\n\nimport remarkLintNoHeadingPunctuation from \"remark-lint-no-heading-punctuation\";\n\nimport { collect, findNodeAt, textOf } from \"../parse.js\";\nimport { runRemarkLintRule } from \"../remark-lint-adapter.js\";\nimport type { Rule } from \"../rule.js\";\n\n/** Punctuation the rule treats as offending — `?` is intentionally absent. */\nconst DISALLOWED = \".,;:!\";\n\n/** Matches a run of disallowed chars at the end of a string. */\nconst TRAILING = new RegExp(\n `[${DISALLOWED.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")}]+$`,\n);\n\nexport const headingPunctuation: Rule = {\n code: \"nimbus/heading-punctuation\",\n run(ctx) {\n const reports = runRemarkLintRule(\n remarkLintNoHeadingPunctuation,\n ctx.file.tree,\n {\n path: ctx.file.path,\n source: ctx.file.source,\n // Pin the disallowed set — default is `.,;:!?`; we drop `?`.\n settings: [DISALLOWED],\n },\n );\n\n for (const r of reports) {\n const heading = findNodeAt(ctx.file.tree, \"heading\", r.line, r.column);\n if (!heading) {\n // Defensive: position drift means we can't reconstruct the\n // dynamic message or the fix. Emit the rule's generic message\n // rather than swallow the diagnostic.\n ctx.report({\n ...r,\n message:\n \"heading ends with trailing punctuation — drop it from the heading.\",\n });\n continue;\n }\n\n const texts = collect(heading, \"text\");\n const last = texts[texts.length - 1];\n const value = typeof last?.value === \"string\" ? last.value : \"\";\n const match = value.match(TRAILING);\n const end = last?.position?.end.offset;\n\n if (!match || typeof end !== \"number\") {\n // remark-lint flagged the heading but our text walk can't find\n // the trailing punct on the last text node — likely because the\n // heading ends with an inline node we don't peer into (a code\n // span, link text, etc.). Emit the diagnostic without a fix.\n ctx.report({\n ...r,\n message: `heading \"${textOf(heading).trim()}\" ends with trailing punctuation — drop it from the heading.`,\n });\n continue;\n }\n\n const punct = match[0];\n ctx.report({\n ...r,\n message: `heading \"${textOf(heading).trim()}\" ends with \"${punct}\" — drop trailing punctuation from headings.`,\n fix: {\n description: `remove the trailing \"${punct}\"`,\n edits: [{ range: [end - punct.length, end], text: \"\" }],\n },\n });\n }\n },\n};\n","/**\n * Tiny Levenshtein distance + \"did you mean\" suggester.\n *\n * Used by the MDX PascalCase validator and any framework diagnostic that\n * wants to suggest a near-match on a misspelled name. Kept internal — user\n * code that wants the same hint duplicates ~10 lines rather than depending\n * on a framework wrapper. See the north-star guardrail on thin wrappers.\n */\n\nexport function levenshtein(a: string, b: string): number {\n if (a === b) return 0;\n if (a.length === 0) return b.length;\n if (b.length === 0) return a.length;\n const v0 = new Array<number>(b.length + 1);\n const v1 = new Array<number>(b.length + 1);\n // `!` on every indexed read: arrays are pre-allocated to length b.length+1\n // and every index used here is loop-bounded within that range.\n for (let i = 0; i <= b.length; i++) v0[i] = i;\n for (let i = 0; i < a.length; i++) {\n v1[0] = i + 1;\n for (let j = 0; j < b.length; j++) {\n const cost = a[i] === b[j] ? 0 : 1;\n v1[j + 1] = Math.min(v1[j]! + 1, v0[j + 1]! + 1, v0[j]! + cost);\n }\n for (let j = 0; j <= b.length; j++) v0[j] = v1[j]!;\n }\n return v1[b.length]!;\n}\n\n/**\n * Return the closest candidate within `maxDist`, or null.\n *\n * Comparison is case-insensitive (so \"tabs\" suggests \"Tabs\"), but the\n * returned name keeps its original casing.\n */\nexport function suggest(\n target: string,\n candidates: Iterable<string>,\n maxDist = 3,\n): string | null {\n const targetLower = target.toLowerCase();\n let best: { name: string; dist: number } | null = null;\n for (const c of candidates) {\n const dist = levenshtein(targetLower, c.toLowerCase());\n if (dist <= maxDist && (!best || dist < best.dist)) {\n best = { name: c, dist };\n }\n }\n return best?.name ?? null;\n}\n","/**\n * nimbus/image-ref — image references that don't resolve to a file on\n * disk. Unlike `internal-link` (whose truth is the emergent route set,\n * materialized at build time), image truth is just the filesystem: a\n * site-absolute ref maps to `public/`, a relative ref to the authoring\n * file's directory. No build prerequisite, no silent-skip machinery.\n *\n * Coverage:\n * - `image` nodes (``)\n * - `imageReference` nodes (`![alt][ref]` resolved against `definition`s)\n * - MDX JSX `<img src=\"...\">`\n * - Extra JSX components opt-in via `components: [{ name, attr }, …]` —\n * same shape as `internal-link`'s option, same rationale: component\n * names belong to the user.\n *\n * Resolution:\n * - `/foo.png` → `<root>/public/foo.png` (Astro serves `public/` at the\n * site root).\n * - `./shot.png` / `../img.png` → relative to the MDX file (Astro's image\n * pipeline resolves these as imports — they're valid and checkable).\n * - `aliases: { \"~/assets/\": \"src/assets/\" }` maps prefix → root-relative\n * directory. The framework ships none by default — `~/` is a per-project\n * tsconfig path, not a framework concept.\n * - External URLs (any scheme, incl. `data:`, and `//`) are skipped —\n * remote existence checks are a network concern, not a lint.\n * - Dynamic JSX attrs (`<img src={x}>`) are skipped — not checkable.\n *\n * A miss whose containing directory exists produces a \"did you mean\" hint\n * from that directory's entries via Levenshtein distance.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { suggest } from \"../../_internal/levenshtein.js\";\nimport { collect, startOf, visit, type MdNode } from \"../parse.js\";\nimport type { Rule } from \"../rule.js\";\n\nexport const imageRef: Rule = {\n code: \"nimbus/image-ref\",\n run(ctx) {\n const root = inferProjectRoot(ctx.file.absPath);\n const aliases = readAliases(ctx.options.aliases);\n const ignore = Array.isArray(ctx.options.ignore)\n ? ctx.options.ignore.filter((s): s is string => typeof s === \"string\")\n : [];\n const extraComponents = readExtraComponents(ctx.options.components);\n const definitions = collectDefinitions(ctx.file.tree);\n\n for (const occ of collectImageOccurrences(\n ctx.file.tree,\n definitions,\n extraComponents,\n )) {\n const url = occ.url;\n if (!url) continue;\n if (isExternal(url)) continue;\n\n const cleaned = cleanUrl(url);\n if (cleaned === \"\") continue;\n if (matchesAnyIgnore(cleaned, ignore)) continue;\n\n const resolved = resolveToDisk(cleaned, root, ctx.file.absPath, aliases);\n if (resolved === null) continue; // unrecognised shape — silence beats false-positive\n if (fileExists(resolved.fullPath)) continue;\n\n const hint = suggestSibling(resolved.fullPath);\n ctx.report({\n message: hint\n ? `missing image \"${url}\" — expected at ${resolved.display}; did you mean \"${hint}\"?`\n : `missing image \"${url}\" — expected at ${resolved.display}.`,\n line: occ.line,\n column: occ.column,\n });\n }\n },\n};\n\n// ---------------------------------------------------------------------------\n// AST traversal\n// ---------------------------------------------------------------------------\n\ninterface ImageOccurrence {\n url: string;\n line: number;\n column: number;\n}\n\ninterface ComponentSpec {\n name: string;\n attr: string;\n}\n\n/**\n * `<img src>` is always checked — a plain img means the same thing in\n * every MDX file. Extra components come from the `components` option.\n */\nfunction readExtraComponents(value: unknown): ComponentSpec[] {\n if (!Array.isArray(value)) return [];\n const out: ComponentSpec[] = [];\n for (const item of value) {\n if (!item || typeof item !== \"object\") continue;\n const obj = item as { name?: unknown; attr?: unknown };\n if (typeof obj.name === \"string\" && typeof obj.attr === \"string\") {\n out.push({ name: obj.name, attr: obj.attr });\n }\n }\n return out;\n}\n\nfunction collectImageOccurrences(\n root: MdNode,\n definitions: Map<string, string>,\n extraComponents: ComponentSpec[],\n): ImageOccurrence[] {\n const out: ImageOccurrence[] = [];\n visit(root, (node) => {\n if (node.type === \"image\") {\n const at = startOf(node);\n out.push({\n url: typeof node.url === \"string\" ? node.url : \"\",\n line: at.line,\n column: at.column,\n });\n return;\n }\n if (node.type === \"imageReference\") {\n const identifier =\n typeof node.identifier === \"string\" ? node.identifier : \"\";\n const url = definitions.get(identifier);\n if (!url) return;\n const at = startOf(node);\n out.push({ url, line: at.line, column: at.column });\n return;\n }\n if (\n node.type === \"mdxJsxFlowElement\" ||\n node.type === \"mdxJsxTextElement\"\n ) {\n if (node.name === \"img\") {\n const src = readJsxStringAttr(node, \"src\");\n if (src === null) return;\n const at = startOf(node);\n out.push({ url: src, line: at.line, column: at.column });\n return;\n }\n for (const spec of extraComponents) {\n if (node.name !== spec.name) continue;\n const src = readJsxStringAttr(node, spec.attr);\n if (src === null) return;\n const at = startOf(node);\n out.push({ url: src, line: at.line, column: at.column });\n return;\n }\n }\n });\n return out;\n}\n\nfunction collectDefinitions(root: MdNode): Map<string, string> {\n const out = new Map<string, string>();\n for (const def of collect(root, \"definition\")) {\n const id = typeof def.identifier === \"string\" ? def.identifier : \"\";\n const url = typeof def.url === \"string\" ? def.url : \"\";\n if (id && url && !out.has(id)) out.set(id, url);\n }\n return out;\n}\n\n/**\n * Read a string-valued JSX attribute. Returns null when the attribute is\n * absent, dynamic (expression form `<img src={x}>`), or boolean.\n * Static-only on purpose — dynamic srcs aren't checkable.\n */\nfunction readJsxStringAttr(node: MdNode, name: string): string | null {\n const attrs = (node as { attributes?: unknown }).attributes;\n if (!Array.isArray(attrs)) return null;\n for (const a of attrs) {\n if (!a || typeof a !== \"object\") continue;\n const attr = a as { name?: unknown; value?: unknown };\n if (attr.name !== name) continue;\n if (typeof attr.value === \"string\") return attr.value;\n return null;\n }\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// URL classification + resolution\n// ---------------------------------------------------------------------------\n\nfunction isExternal(url: string): boolean {\n return (\n /^[a-z][a-z0-9+.-]*:/i.test(url) || // any scheme: http:, data:, …\n url.startsWith(\"//\") // protocol-relative\n );\n}\n\n/** Strip query string and hash, then percent-decode. */\nfunction cleanUrl(url: string): string {\n let s = url;\n const q = s.indexOf(\"?\");\n if (q !== -1) s = s.slice(0, q);\n const h = s.indexOf(\"#\");\n if (h !== -1) s = s.slice(0, h);\n try {\n s = decodeURI(s);\n } catch {\n // Malformed encoding — leave as-is; the disk lookup will (correctly)\n // fail and surface a diagnostic the author can fix.\n }\n return s;\n}\n\nfunction readAliases(value: unknown): Array<[prefix: string, dir: string]> {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return [];\n const out: Array<[string, string]> = [];\n for (const [prefix, dir] of Object.entries(value as Record<string, unknown>)) {\n if (typeof dir === \"string\" && prefix.length > 0) out.push([prefix, dir]);\n }\n // Longest prefix wins when aliases nest (`~/assets/icons/` over `~/assets/`).\n out.sort((a, b) => b[0].length - a[0].length);\n return out;\n}\n\ninterface ResolvedRef {\n fullPath: string;\n /** Root-relative form for the diagnostic message. */\n display: string;\n}\n\nfunction resolveToDisk(\n url: string,\n root: string,\n fileAbsPath: string,\n aliases: Array<[string, string]>,\n): ResolvedRef | null {\n for (const [prefix, dir] of aliases) {\n if (url.startsWith(prefix)) {\n const rel = path.join(dir, url.slice(prefix.length));\n return { fullPath: path.join(root, rel), display: rel };\n }\n }\n if (url.startsWith(\"/\")) {\n const rel = path.join(\"public\", url.slice(1));\n return { fullPath: path.join(root, rel), display: rel };\n }\n if (url.startsWith(\"./\") || url.startsWith(\"../\")) {\n const fullPath = path.resolve(path.dirname(fileAbsPath), url);\n const rel = path.relative(root, fullPath);\n return { fullPath, display: rel.startsWith(\"..\") ? fullPath : rel };\n }\n return null;\n}\n\nfunction fileExists(fullPath: string): boolean {\n try {\n return fs.statSync(fullPath).isFile();\n } catch {\n return false;\n }\n}\n\n/**\n * Did-you-mean from the missing file's own directory — cheap (one\n * `readdir`) and covers the dominant failure (typo or wrong extension in\n * the filename, not the directory).\n */\nfunction suggestSibling(fullPath: string): string | null {\n let entries: string[];\n try {\n entries = fs.readdirSync(path.dirname(fullPath));\n } catch {\n return null;\n }\n return suggest(path.basename(fullPath), new Set(entries), 3);\n}\n\n/**\n * Minimal glob matcher — exact match or `prefix/**` suffix, same shape as\n * `internal-link`'s. Patterns are authored against the raw cleaned URL\n * (e.g. `/images/generated/**`).\n */\nfunction matchesAnyIgnore(url: string, patterns: string[]): boolean {\n if (patterns.length === 0) return false;\n for (const pat of patterns) {\n const stripped =\n pat.length > 1 && pat.endsWith(\"/\") ? pat.slice(0, -1) : pat;\n if (stripped.endsWith(\"/**\")) {\n const prefix = stripped.slice(0, -3);\n if (url === prefix || url.startsWith(`${prefix}/`)) return true;\n } else if (url === stripped) {\n return true;\n }\n }\n return false;\n}\n\n/** Find the project root from a content file by walking up to the parent of `src`. */\nfunction inferProjectRoot(absPath: string): string {\n const norm = absPath.replace(/\\\\/g, \"/\");\n const idx = norm.lastIndexOf(\"/src/\");\n return idx === -1 ? path.dirname(absPath) : norm.slice(0, idx);\n}\n","/**\n * nimbus/internal-link — internal links that don't resolve to a real\n * page on the site. Reads route truth from `.nimbus/routes.json`\n * materialized at integration time; without that file the rule skips\n * silently (every link would otherwise false-positive — the worst\n * outcome for a trust-sensitive rule).\n *\n * Coverage:\n * - `link` nodes (`[text](url)`)\n * - `linkReference` nodes (`[text][ref]` resolved against `definition`s)\n * - MDX JSX `<a href=\"...\">`\n * - Extra JSX components opt-in via `components: [{ name, attr }, …]` —\n * e.g. the starter's `<LinkCard href>`. The framework only ships the\n * `<a>` default because the starter's component names belong to the\n * user (rename, replace, delete at will); hardcoding them here would\n * couple the rule to a moving target.\n *\n * Resolution:\n * - External links (with a scheme) are skipped.\n * - In-page anchors (`#section`) are skipped (hash validation lives in\n * the future `nimbus/internal-link-hash` rule).\n * - The Astro `base` prefix is normalized away on both sides.\n * - Links under an opaque namespace (a non-framework dynamic route file)\n * stay silent — silence beats false-positive.\n * - When the framework root catch-all is present, content entries are\n * the truth for the root namespace.\n * - A near-match in the route set produces a \"did you mean\" hint via\n * Levenshtein distance — same pattern `component-pascalcase` uses.\n *\n * Relative links (`./foo`, `../bar`) error by default. `allowRelative: true`\n * silences them for projects that want to use them.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { suggest } from \"../../_internal/levenshtein.js\";\nimport {\n collect,\n startOf,\n visit,\n type MdNode,\n type ParsedFile,\n} from \"../parse.js\";\nimport type { Rule } from \"../rule.js\";\nimport type { RouteTruth } from \"../site-model.js\";\n\n// Process-level cache: read `routes.json` once per CLI invocation, not\n// once per file. The rule itself is stateless; the cache lives in the\n// module scope.\nlet cached: { root: string; truth: RouteTruth | null } | null = null;\nlet missingWarned = false;\n\nfunction loadRouteTruth(file: ParsedFile): RouteTruth | null {\n const root = inferProjectRoot(file.absPath);\n if (cached && cached.root === root) return cached.truth;\n\n let truth: RouteTruth | null = null;\n try {\n const raw = fs.readFileSync(\n path.join(root, \".nimbus\", \"routes.json\"),\n \"utf8\",\n );\n const parsed = JSON.parse(raw) as RouteTruth;\n if (parsed.version === 1) truth = parsed;\n } catch {\n if (!missingWarned) {\n process.stderr.write(\n \"nimbus/internal-link: skipped — `.nimbus/routes.json` is missing. Run `astro build` first; the route truth is materialized at `astro:build:done`.\\n\",\n );\n missingWarned = true;\n }\n }\n cached = { root, truth };\n return truth;\n}\n\n/** Find the project root from a content file by walking up to the parent of `src`. */\nfunction inferProjectRoot(absPath: string): string {\n // `/<root>/src/content/.../page.mdx` — strip from the *last* `/src/` so\n // a developer path that happens to contain `/src/` higher up (e.g.\n // `/Users/me/src/projects/my-docs/src/content/...`) infers `my-docs`,\n // not `/Users/me`.\n const norm = absPath.replace(/\\\\/g, \"/\");\n const idx = norm.lastIndexOf(\"/src/\");\n return idx === -1 ? path.dirname(absPath) : norm.slice(0, idx);\n}\n\n// ---------------------------------------------------------------------------\n\nexport const internalLink: Rule = {\n code: \"nimbus/internal-link\",\n run(ctx) {\n // Skip draft sources. Drafts are excluded from `routes.json` (the\n // framework filters them everywhere — content queries, sidebar,\n // version alternates), so a draft linking to another draft would\n // false-positive against the published route truth. Drafts are\n // in-flight; their links get rewritten before publishing anyway.\n // Published-page → draft links still go un-flagged, which is the\n // known trade-off vs. the route-tagged alternative.\n if (ctx.file.frontmatter?.draft === true) return;\n\n const truth = loadRouteTruth(ctx.file);\n if (!truth) return;\n\n const allowRelative = ctx.options.allowRelative === true;\n const ignore = Array.isArray(ctx.options.ignore)\n ? ctx.options.ignore.filter((s): s is string => typeof s === \"string\")\n : [];\n const extraComponents = readExtraComponents(ctx.options.components);\n\n // Route truth comes pre-resolved by Astro — see `astro:routes:resolved`\n // in `integration.ts`. We just compare against it.\n const knownRoutes = new Set<string>(truth.knownRoutes);\n const definitions = collectDefinitions(ctx.file.tree);\n\n for (const occ of collectLinkOccurrences(ctx.file.tree, definitions, extraComponents)) {\n const url = occ.url;\n if (!url) continue;\n if (isExternal(url)) continue;\n if (url.startsWith(\"#\")) continue; // in-page anchor\n\n if (isRelative(url)) {\n if (allowRelative) continue;\n ctx.report({\n message: `relative link \"${url}\" — internal docs links should be root-relative (e.g. /foo).`,\n line: occ.line,\n column: occ.column,\n });\n continue;\n }\n\n // Normalize first, then match `ignore` against the post-base form.\n // Authors write patterns relative to the site root (`/api/**`),\n // matching them against the raw URL would miss `/docs/api/foo` on a\n // site with `base: \"/docs\"` — the bug the original ordering had.\n const normalized = normalizeForLookup(url, truth.base);\n if (matchesAnyIgnore(normalized, ignore)) continue;\n if (isUnderOpaqueNamespace(normalized, truth.opaqueNamespaces)) continue;\n if (knownRoutes.has(normalized)) continue;\n\n const hint = suggest(normalized, knownRoutes, 3);\n ctx.report({\n message: hint\n ? `broken link \"${url}\" — did you mean \"${denormalize(hint, truth.base)}\"?`\n : `broken link \"${url}\" — no page resolves to this path.`,\n line: occ.line,\n column: occ.column,\n ...(hint\n ? {\n fix: {\n description: `replace \"${url}\" with \"${denormalize(hint, truth.base)}\"`,\n edits: [],\n },\n }\n : {}),\n });\n }\n },\n};\n\n// ---------------------------------------------------------------------------\n// AST traversal\n// ---------------------------------------------------------------------------\n\ninterface LinkOccurrence {\n url: string;\n line: number;\n column: number;\n}\n\ninterface ComponentSpec {\n name: string;\n attr: string;\n}\n\n/**\n * `<a href>` is always checked — plain anchors mean the same thing in\n * every MDX file. Extra components come from the `components` option.\n */\nfunction readExtraComponents(value: unknown): ComponentSpec[] {\n if (!Array.isArray(value)) return [];\n const out: ComponentSpec[] = [];\n for (const item of value) {\n if (!item || typeof item !== \"object\") continue;\n const obj = item as { name?: unknown; attr?: unknown };\n if (typeof obj.name === \"string\" && typeof obj.attr === \"string\") {\n out.push({ name: obj.name, attr: obj.attr });\n }\n }\n return out;\n}\n\n/**\n * Collect every internal-link candidate from the tree, normalized into one\n * shape so the rule's main loop doesn't fork on node type.\n */\nfunction collectLinkOccurrences(\n root: MdNode,\n definitions: Map<string, string>,\n extraComponents: ComponentSpec[],\n): LinkOccurrence[] {\n const out: LinkOccurrence[] = [];\n visit(root, (node) => {\n if (node.type === \"link\") {\n const at = startOf(node);\n out.push({\n url: typeof node.url === \"string\" ? node.url : \"\",\n line: at.line,\n column: at.column,\n });\n return;\n }\n if (node.type === \"linkReference\") {\n const identifier =\n typeof node.identifier === \"string\" ? node.identifier : \"\";\n const url = definitions.get(identifier);\n if (!url) return;\n const at = startOf(node);\n out.push({ url, line: at.line, column: at.column });\n return;\n }\n if (\n node.type === \"mdxJsxFlowElement\" ||\n node.type === \"mdxJsxTextElement\"\n ) {\n if (node.name === \"a\") {\n const href = readJsxStringAttr(node, \"href\");\n if (href === null) return;\n const at = startOf(node);\n out.push({ url: href, line: at.line, column: at.column });\n return;\n }\n for (const spec of extraComponents) {\n if (node.name !== spec.name) continue;\n const href = readJsxStringAttr(node, spec.attr);\n if (href === null) return;\n const at = startOf(node);\n out.push({ url: href, line: at.line, column: at.column });\n return;\n }\n }\n });\n return out;\n}\n\nfunction collectDefinitions(root: MdNode): Map<string, string> {\n const out = new Map<string, string>();\n for (const def of collect(root, \"definition\")) {\n const id = typeof def.identifier === \"string\" ? def.identifier : \"\";\n const url = typeof def.url === \"string\" ? def.url : \"\";\n if (id && url && !out.has(id)) out.set(id, url);\n }\n return out;\n}\n\n/**\n * Read a string-valued JSX attribute. Returns null when the attribute is\n * absent, dynamic (expression form `<a href={x}>`), or boolean (`<a\n * disabled>`). Static-only on purpose — dynamic hrefs aren't link-checkable.\n */\nfunction readJsxStringAttr(node: MdNode, name: string): string | null {\n const attrs = (node as { attributes?: unknown }).attributes;\n if (!Array.isArray(attrs)) return null;\n for (const a of attrs) {\n if (!a || typeof a !== \"object\") continue;\n const attr = a as { name?: unknown; value?: unknown };\n if (attr.name !== name) continue;\n if (typeof attr.value === \"string\") return attr.value;\n return null;\n }\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// URL classification + normalization\n// ---------------------------------------------------------------------------\n\nfunction isExternal(url: string): boolean {\n return (\n /^[a-z][a-z0-9+.-]*:/i.test(url) || // any scheme: http:, mailto:, tel:, …\n url.startsWith(\"//\") // protocol-relative\n );\n}\n\nfunction isRelative(url: string): boolean {\n return url.startsWith(\"./\") || url.startsWith(\"../\");\n}\n\n/**\n * Strip the Astro `base` prefix, any query string, any hash, and the\n * trailing slash, then percent-decode. Result is the canonical form used\n * in the route truth's `contentRoutes` and `pageRoutes` — Astro emits\n * routes with raw (decoded) segments, so an authored link like\n * `[x](/guides/setup%20notes)` must decode to match a route stored as\n * `/guides/setup notes`.\n */\nfunction normalizeForLookup(url: string, base: string): string {\n let s = url;\n const q = s.indexOf(\"?\");\n if (q !== -1) s = s.slice(0, q);\n const h = s.indexOf(\"#\");\n if (h !== -1) s = s.slice(0, h);\n\n const normBase = stripTrailingSlash(base === \"\" ? \"\" : base.startsWith(\"/\") ? base : `/${base}`);\n if (normBase !== \"\" && normBase !== \"/\" && s.startsWith(normBase + \"/\")) {\n s = s.slice(normBase.length);\n } else if (normBase !== \"\" && normBase !== \"/\" && s === normBase) {\n s = \"/\";\n }\n\n s = stripTrailingSlash(s);\n if (s === \"\") s = \"/\";\n try {\n s = decodeURI(s);\n } catch {\n // Malformed encoding — leave as-is so the lookup will (correctly) fail\n // and surface a broken-link diagnostic the author can fix.\n }\n return s;\n}\n\n/** Re-attach `base` for display in \"did you mean\" hints. */\nfunction denormalize(route: string, base: string): string {\n if (!base || base === \"/\" || base === \"\") return route;\n const normBase = base.startsWith(\"/\") ? stripTrailingSlash(base) : `/${stripTrailingSlash(base)}`;\n return route === \"/\" ? normBase : `${normBase}${route}`;\n}\n\nfunction stripTrailingSlash(s: string): string {\n return s.length > 1 && s.endsWith(\"/\") ? s.slice(0, -1) : s;\n}\n\nfunction isUnderOpaqueNamespace(\n route: string,\n opaqueNamespaces: string[],\n): boolean {\n for (const ns of opaqueNamespaces) {\n if (ns === \"/\") return true;\n if (route === ns) return true;\n if (route.startsWith(`${ns}/`)) return true;\n }\n return false;\n}\n\n/**\n * Minimal glob matcher — exact match or `prefix/**` suffix. Covers the\n * common `ignore` patterns (`/api/**`, `/changelog/**`) without pulling\n * in picomatch. Input is the post-`normalizeForLookup` URL (no `base`\n * prefix, no trailing slash, no hash/query), so patterns are authored\n * against the canonical site-root form.\n */\nfunction matchesAnyIgnore(normalizedUrl: string, patterns: string[]): boolean {\n if (patterns.length === 0) return false;\n for (const pat of patterns) {\n const stripped = stripTrailingSlash(pat);\n if (stripped.endsWith(\"/**\")) {\n const prefix = stripped.slice(0, -3);\n if (normalizedUrl === prefix || normalizedUrl.startsWith(`${prefix}/`)) {\n return true;\n }\n } else if (normalizedUrl === stripped) {\n return true;\n }\n }\n return false;\n}\n\n// Test-only export — clears the process-level cache. Real callers want one\n// load per CLI run; tests want isolation between cases.\nexport function _resetInternalLinkCacheForTests(): void {\n cached = null;\n missingWarned = false;\n}\n","/**\n * remark-lint rule to warn when unordered list markers are inconsistent.\n *\n * ## What is this?\n *\n * This package checks unordered list markers.\n *\n * ## When should I use this?\n *\n * You can use this package to check unordered lists.\n *\n * ## API\n *\n * ### `unified().use(remarkLintUnorderedListMarkerStyle[, options])`\n *\n * Warn when unordered list markers are inconsistent.\n *\n * ###### Parameters\n *\n * * `options` ([`Options`][api-options], default: `'consistent'`)\n * — preferred style or whether to detect the first style and warn for\n * further differences\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * ### `Options`\n *\n * Configuration (TypeScript type).\n *\n * ###### Type\n *\n * ```ts\n * type Options = Style | 'consistent'\n * ```\n *\n * ### `Style`\n *\n * Style (TypeScript type).\n *\n * ###### Type\n *\n * ```ts\n * type Style = '*' | '+' | '-'\n * ```\n *\n * ## Recommendation\n *\n * Because asterisks can be used as a marker for more markdown constructs,\n * it’s recommended to use that for lists (and thematic breaks, emphasis,\n * strong) too.\n *\n * ## Fix\n *\n * [`remark-stringify`][github-remark-stringify] formats unordered lists with\n * asterisks by default.\n * Pass `bullet: '+'` or `bullet: '-'` to use a different marker.\n *\n * [api-options]: #options\n * [api-style]: #style\n * [api-remark-lint-unordered-list-marker-style]: #unifieduseremarklintunorderedlistmarkerstyle-options\n * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify\n * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\n *\n * @module unordered-list-marker-style\n * @author Titus Wormer\n * @copyright Titus Wormer\n * @license MIT\n * @example\n * {\"name\": \"ok.md\"}\n *\n * * Mercury\n *\n * 1. Venus\n *\n * * Earth\n *\n * @example\n * {\"name\": \"ok.md\", \"config\": \"*\"}\n *\n * * Mercury\n *\n * @example\n * {\"name\": \"ok.md\", \"config\": \"-\"}\n *\n * - Mercury\n *\n * @example\n * {\"name\": \"ok.md\", \"config\": \"+\"}\n *\n * + Mercury\n *\n * @example\n * {\"name\": \"not-ok.md\", \"label\": \"input\"}\n *\n * * Mercury\n *\n * - Venus\n *\n * + Earth\n * @example\n * {\"name\": \"not-ok.md\", \"label\": \"output\"}\n *\n * 3:1: Unexpected unordered list marker `-`, expected `*`\n * 5:1: Unexpected unordered list marker `+`, expected `*`\n *\n * @example\n * {\"name\": \"not-ok.md\", \"label\": \"output\", \"config\": \"🌍\", \"positionless\": true}\n *\n * 1:1: Unexpected value `🌍` for `options`, expected `'*'`, `'+'`, `'-'`, or `'consistent'`\n */\n\n/**\n * @import {Root} from 'mdast'\n */\n\n/**\n * @typedef {Style | 'consistent'} Options\n * Configuration.\n *\n * @typedef {'*' | '+' | '-'} Style\n * Styles.\n */\n\nimport {phrasing} from 'mdast-util-phrasing'\nimport {lintRule} from 'unified-lint-rule'\nimport {pointStart} from 'unist-util-position'\nimport {SKIP, visitParents} from 'unist-util-visit-parents'\nimport {VFileMessage} from 'vfile-message'\n\nconst remarkLintUnorderedListMarkerStyle = lintRule(\n {\n origin: 'remark-lint:unordered-list-marker-style',\n url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-unordered-list-marker-style#readme'\n },\n /**\n * @param {Root} tree\n * Tree.\n * @param {Options | null | undefined} [options='consistent']\n * Configuration (default: `'consistent'`).\n * @returns {undefined}\n * Nothing.\n */\n function (tree, file, options) {\n const value = String(file)\n /** @type {Style | undefined} */\n let expected\n /** @type {VFileMessage | undefined} */\n let cause\n\n if (options === null || options === undefined || options === 'consistent') {\n // Empty.\n } else if (options === '*' || options === '+' || options === '-') {\n expected = options\n } else {\n file.fail(\n 'Unexpected value `' +\n options +\n \"` for `options`, expected `'*'`, `'+'`, `'-'`, or `'consistent'`\"\n )\n }\n\n visitParents(tree, function (node, parents) {\n // Do not walk into phrasing.\n if (phrasing(node)) {\n return SKIP\n }\n\n if (node.type !== 'listItem') return\n\n const parent = parents.at(-1)\n\n if (!parent || parent.type !== 'list' || parent.ordered) return\n\n const place = pointStart(node)\n\n if (!place || typeof place.offset !== 'number') return\n\n const code = value.charCodeAt(place.offset)\n\n const actual =\n code === 42 /* `*` */\n ? '*'\n : code === 43 /* `+` */\n ? '+'\n : code === 45 /* `-` */\n ? '-'\n : /* c8 ignore next -- weird ASTs. */\n undefined\n\n /* c8 ignore next -- weird ASTs. */\n if (!actual) return\n\n if (expected) {\n if (actual !== expected) {\n file.message(\n 'Unexpected unordered list marker `' +\n actual +\n '`, expected `' +\n expected +\n '`',\n {ancestors: [...parents, node], cause, place}\n )\n }\n } else {\n expected = actual\n cause = new VFileMessage(\n 'Unordered list marker style `' +\n expected +\n \"` first defined for `'consistent'` here\",\n {\n ancestors: [...parents, node],\n place,\n ruleId: 'unordered-list-marker-style',\n source: 'remark-lint'\n }\n )\n }\n })\n }\n)\n\nexport default remarkLintUnorderedListMarkerStyle\n","/**\n * nimbus/list-marker-style — consistent bullet marker across the docs.\n * `style?: \"dash\" | \"asterisk\"` (default `dash`). Auto-fixable: swap the\n * marker character on the offending list item.\n *\n * Detection is delegated to `remark-lint-unordered-list-marker-style`\n * via the adapter (configured with the chosen marker). The wrapper\n * re-walks the tree at each reported position to recover the listItem\n * offset for the surgical fix.\n */\n\nimport remarkLintUnorderedListMarkerStyle from \"remark-lint-unordered-list-marker-style\";\n\nimport { findNodeAt } from \"../parse.js\";\nimport { runRemarkLintRule } from \"../remark-lint-adapter.js\";\nimport type { Rule } from \"../rule.js\";\n\nconst MARKER = { dash: \"-\", asterisk: \"*\" } as const;\n\nexport const listMarkerStyle: Rule = {\n code: \"nimbus/list-marker-style\",\n run(ctx) {\n const style = ctx.options.style === \"asterisk\" ? \"asterisk\" : \"dash\";\n const want = MARKER[style];\n\n const reports = runRemarkLintRule(\n remarkLintUnorderedListMarkerStyle,\n ctx.file.tree,\n {\n path: ctx.file.path,\n source: ctx.file.source,\n settings: [want],\n },\n );\n\n for (const r of reports) {\n const item = findNodeAt(ctx.file.tree, \"listItem\", r.line, r.column);\n const offset = item?.position?.start.offset;\n if (typeof offset !== \"number\") {\n ctx.report({\n ...r,\n message: `bullet marker should be \"${want}\".`,\n });\n continue;\n }\n const ch = ctx.file.source[offset];\n if (ch !== \"-\" && ch !== \"*\" && ch !== \"+\") {\n // Defensive: the offset doesn't land on a real marker character.\n ctx.report({\n ...r,\n message: `bullet marker should be \"${want}\".`,\n });\n continue;\n }\n\n ctx.report({\n ...r,\n message: `bullet uses \"${ch}\" — this project's list marker is \"${want}\".`,\n fix: {\n description: `change \"${ch}\" to \"${want}\"`,\n edits: [{ range: [offset, offset + 1], text: want }],\n },\n });\n }\n },\n};\n","/**\n * nimbus/no-self-host-url — same-site links should be root-relative\n * (`/page`), not absolute URLs at the site's own host. Absolute self-host\n * links break across environments (preview vs production) and skip the\n * router.\n *\n * The project's `site` URL (from `nimbusConfig.site`, threaded through\n * `ctx.site`) is always banned — the rule infers the deploy host\n * automatically so authors don't have to duplicate it in their lint\n * config. Localhost/loopback hosts are always banned too. Additional\n * hosts go in `hosts?: string[]` (e.g. legacy domains, www subdomains\n * that don't redirect, or staging hostnames).\n */\n\nimport { collect, startOf } from \"../parse.js\";\nimport type { Rule } from \"../rule.js\";\n\nconst ALWAYS_BANNED = [\"localhost\", \"127.0.0.1\", \"0.0.0.0\"];\n\nexport const noSelfHostUrl: Rule = {\n code: \"nimbus/no-self-host-url\",\n run(ctx) {\n const configured = Array.isArray(ctx.options.hosts)\n ? ctx.options.hosts.filter((h): h is string => typeof h === \"string\")\n : [];\n const siteHost = hostnameOf(ctx.site);\n const banned = [\n ...ALWAYS_BANNED,\n ...(siteHost ? [siteHost] : []),\n ...configured,\n ];\n\n for (const link of collect(ctx.file.tree, \"link\")) {\n const url = typeof link.url === \"string\" ? link.url : \"\";\n let hostname: string;\n try {\n hostname = new URL(url).hostname;\n } catch {\n continue; // relative or non-URL — fine\n }\n const hit = banned.some(\n (b) => hostname === b || hostname.endsWith(`.${b}`),\n );\n if (!hit) continue;\n\n const at = startOf(link);\n ctx.report({\n message: `link points at self-host \"${hostname}\" — use a root-relative path (e.g. /page) for same-site links.`,\n line: at.line,\n column: at.column,\n });\n }\n },\n};\n\n/** Extract a bare hostname from a `site`-shaped value, or null if not parseable. */\nfunction hostnameOf(site: string | undefined): string | null {\n if (!site) return null;\n try {\n return new URL(site).hostname;\n } catch {\n return null;\n }\n}\n","/**\n * remark-lint rule to warn when top-level headings are used multiple times.\n *\n * ## What is this?\n *\n * This package checks that top-level headings are unique.\n *\n * ## When should I use this?\n *\n * You can use this package to check heading structure.\n *\n * ## API\n *\n * ### `unified().use(remarkLintNoMultipleToplevelHeadings[, options])`\n *\n * Warn when top-level headings are used multiple times.\n *\n * ###### Parameters\n *\n * * `options` ([`Options`][api-options], default: `1`)\n * — configuration\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * ### `Depth`\n *\n * Depth (TypeScript type).\n *\n * ###### Type\n *\n * ```ts\n * type Depth = 1 | 2 | 3 | 4 | 5 | 6\n * ```\n *\n * ### `Options`\n *\n * Configuration (TypeScript type).\n *\n * ###### Type\n *\n * ```ts\n * type Options = Depth\n * ```\n *\n * ## Recommendation\n *\n * Documents should almost always have one main heading,\n * which is typically a heading with a rank of `1`.\n *\n * [api-depth]: #depth\n * [api-options]: #options\n * [api-remark-lint-no-multiple-toplevel-headings]: #unifieduseremarklintnomultipletoplevelheadings-options\n * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify\n * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\n *\n * @module no-multiple-toplevel-headings\n * @author Titus Wormer\n * @copyright Titus Wormer\n * @license MIT\n *\n * @example\n * {\"name\": \"ok.md\"}\n *\n * # Mercury\n *\n * ## Venus\n *\n * @example\n * {\"label\": \"input\", \"name\": \"not-ok.md\"}\n *\n * # Venus\n *\n * # Mercury\n * @example\n * {\"label\": \"output\", \"name\": \"not-ok.md\"}\n *\n * 3:1-3:10: Unexpected duplicate toplevel heading, exected a single heading with rank `1`\n *\n * @example\n * {\"config\": 2, \"label\": \"input\", \"name\": \"not-ok.md\"}\n *\n * ## Venus\n *\n * ## Mercury\n * @example\n * {\"config\": 2, \"label\": \"output\", \"name\": \"not-ok.md\"}\n *\n * 3:1-3:11: Unexpected duplicate toplevel heading, exected a single heading with rank `2`\n *\n * @example\n * {\"label\": \"input\", \"name\": \"html.md\"}\n *\n * Venus <b>and</b> mercury.\n *\n * <h1>Earth</h1>\n *\n * <h1>Mars</h1>\n * @example\n * {\"label\": \"output\", \"name\": \"html.md\"}\n *\n * 5:1-5:14: Unexpected duplicate toplevel heading, exected a single heading with rank `1`\n *\n * @example\n * {\"label\": \"input\", \"mdx\": true, \"name\": \"mdx.mdx\"}\n *\n * Venus <b>and</b> mercury.\n *\n * <h1>Earth</h1>\n * <h1>Mars</h1>\n * @example\n * {\"label\": \"output\", \"mdx\": true, \"name\": \"mdx.mdx\"}\n *\n * 4:1-4:14: Unexpected duplicate toplevel heading, exected a single heading with rank `1`\n */\n\n/**\n * @import {Heading, Nodes, Root} from 'mdast'\n * @import {} from 'mdast-util-mdx'\n */\n\n/**\n * @typedef {Heading['depth']} Depth\n * Styles.\n *\n * @typedef {Depth} Options\n * Configuration.\n */\n\nimport {ok as assert} from 'devlop'\nimport {lintRule} from 'unified-lint-rule'\nimport {visitParents} from 'unist-util-visit-parents'\nimport {VFileMessage} from 'vfile-message'\n\nconst htmlRe = /<h([1-6])/\nconst jsxNameRe = /^h([1-6])$/\n\nconst remarkLintNoMultipleToplevelHeadings = lintRule(\n {\n origin: 'remark-lint:no-multiple-toplevel-headings',\n url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-multiple-toplevel-headings#readme'\n },\n /**\n * @param {Root} tree\n * Tree.\n * @param {Options | null | undefined} [options=1]\n * Configuration (default: `1`).\n * @returns {undefined}\n * Nothing.\n */\n function (tree, file, options) {\n const option = options || 1\n /** @type {Array<Nodes> | undefined} */\n let duplicateAncestors\n\n visitParents(tree, function (node, parents) {\n /** @type {Depth | undefined} */\n let rank\n\n if (node.type === 'heading') {\n rank = node.depth\n } else if (node.type === 'html') {\n const results = node.value.match(htmlRe)\n rank = results ? /** @type {Depth} */ (Number(results[1])) : undefined\n } else if (\n (node.type === 'mdxJsxFlowElement' ||\n node.type === 'mdxJsxTextElement') &&\n node.name\n ) {\n const results = node.name.match(jsxNameRe)\n rank = results ? /** @type {Depth} */ (Number(results[1])) : undefined\n }\n\n if (rank) {\n const ancestors = [...parents, node]\n\n if (node.position && rank === option) {\n if (duplicateAncestors) {\n const duplicate = duplicateAncestors.at(-1)\n assert(duplicate) // Always defined.\n\n file.message(\n 'Unexpected duplicate toplevel heading, exected a single heading with rank `' +\n rank +\n '`',\n {\n ancestors,\n cause: new VFileMessage(\n 'Toplevel heading already defined here',\n {\n ancestors: duplicateAncestors,\n place: duplicate.position,\n source: 'remark-lint',\n ruleId: 'no-multiple-toplevel-headings'\n }\n ),\n place: node.position\n }\n )\n } else {\n duplicateAncestors = ancestors\n }\n }\n }\n })\n }\n)\n\nexport default remarkLintNoMultipleToplevelHeadings\n","/**\n * nimbus/single-h1 — a page should have at most one top-level (`#`)\n * heading. Reports every H1 after the first. Zero H1s is fine: many\n * layouts render the page title from frontmatter, so the body legitimately\n * starts at H2.\n *\n * Detection is delegated to `remark-lint-no-multiple-toplevel-headings`\n * via the remark-lint adapter — Sätteri-parsed tree, remark-lint detector\n * logic, our message + envelope. The message stays Nimbus-shaped so the\n * agent-loop hint (\"demote to ##\") is preserved.\n */\n\nimport remarkLintNoMultipleTopLevelHeadings from \"remark-lint-no-multiple-toplevel-headings\";\n\nimport { runRemarkLintRule } from \"../remark-lint-adapter.js\";\nimport type { Rule } from \"../rule.js\";\n\nexport const singleH1: Rule = {\n code: \"nimbus/single-h1\",\n run(ctx) {\n const reports = runRemarkLintRule(\n remarkLintNoMultipleTopLevelHeadings,\n ctx.file.tree,\n { path: ctx.file.path, source: ctx.file.source },\n );\n for (const r of reports) {\n ctx.report({\n ...r,\n message:\n 'more than one top-level \"#\" heading — a page should have a single H1. Demote this to \"##\" or fold it into the page above.',\n });\n }\n },\n};\n","/**\n * The rule registry. Authoring rules implemented so far span the content\n * shape (Phase 1–2), markdown formatting (Phase 3), and route awareness\n * (Phase 3 `internal-link`). The remaining sidebar-aware rules\n * (`orphan-page`, `sidebar-entry`) and build validators land in later\n * increments.\n */\n\nimport type { RuleCode } from \"../diagnostic.js\";\nimport type { Rule } from \"../rule.js\";\nimport { bareUrl } from \"./bare-url.js\";\nimport { codeBlockLang } from \"./code-block-lang.js\";\nimport { codeBlockPromptPrefix } from \"./code-block-prompt-prefix.js\";\nimport { descriptionRequired } from \"./description-required.js\";\nimport { duplicateHeadingText } from \"./duplicate-heading-text.js\";\nimport { emphasisStyle } from \"./emphasis-style.js\";\nimport { frontmatterShape } from \"./frontmatter-shape.js\";\nimport { headingHierarchy } from \"./heading-hierarchy.js\";\nimport { headingPunctuation } from \"./heading-punctuation.js\";\nimport { imageRef } from \"./image-ref.js\";\nimport { internalLink } from \"./internal-link.js\";\nimport { listMarkerStyle } from \"./list-marker-style.js\";\nimport { noSelfHostUrl } from \"./no-self-host-url.js\";\nimport { singleH1 } from \"./single-h1.js\";\n\nexport const RULES: Rule[] = [\n // Content shape\n frontmatterShape,\n descriptionRequired,\n singleH1,\n headingHierarchy,\n codeBlockLang,\n codeBlockPromptPrefix,\n noSelfHostUrl,\n // Markdown formatting\n headingPunctuation,\n duplicateHeadingText,\n listMarkerStyle,\n emphasisStyle,\n bareUrl,\n // Route-aware\n internalLink,\n imageRef,\n];\n\n/** Codes with a wired implementation (a subset of `RULE_CODES`). */\nexport const IMPLEMENTED_CODES: ReadonlySet<RuleCode> = new Set(\n RULES.map((r) => r.code),\n);\n"],"x_google_ignoreList":[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,23,24,25,30,32,36,38,43,46],"mappings":";;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I;;AAG/D,OAAI,MAAM;IACR,MAAM,YAAY,CAAC,GAAG,SAAS,KAAK;AAEpC,QAAI,KAAK,YAAY,SAAS,OAC5B,KAAI,oBAAoB;KACtB,MAAM,YAAY,mBAAmB,GAAG,GAAG;AAC3C,wBAAO,UAAU;AAEjB,UAAK,QACH,gFACE,OACA,KACF;MACE;MACA,OAAO,IAAI,aACT,yCACA;OACE,WAAW;OACX,OAAO,UAAU;OACjB,QAAQ;OACR,QAAQ;OACT,CACF;MACD,OAAO,KAAK;MACb,CACF;UAED,sBAAqB;;IAI3B;;CAEL;;;;;;;;;;;;;;;AC9LD,MAAa,WAAiB;CAC5B,MAAM;CACN,IAAI,KAAK;EACP,MAAM,UAAU,kBACdM,sCACA,IAAI,KAAK,MACT;GAAE,MAAM,IAAI,KAAK;GAAM,QAAQ,IAAI,KAAK;GAAQ,CACjD;AACD,OAAK,MAAM,KAAK,QACd,KAAI,OAAO;GACT,GAAG;GACH,SACE;GACH,CAAC;;CAGP;;;;ACRD,MAAa,QAAgB;CAE3B;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CAEA;CACA;CACD;;AAGD,MAAa,oBAA2C,IAAI,IAC1D,MAAM,KAAK,MAAM,EAAE,KAAK,CACzB"}
|
|
1
|
+
{"version":3,"file":"rules-DDDvKkyJ.js","names":["point","ok","isUint8Array","isPlainObj","parseYaml","jsxNameRe","htmlRe","jsxNameRe","jsxNameRe","inferProjectRoot","readExtraComponents","collectDefinitions","isExternal","matchesAnyIgnore","readJsxStringAttr","remarkLintNoMultipleTopLevelHeadings"],"sources":["../src/lint/diagnostic.ts","../src/lint/config.ts","../../../node_modules/.pnpm/mdast-util-to-string@4.0.0/node_modules/mdast-util-to-string/lib/index.js","../../../node_modules/.pnpm/micromark-util-character@2.1.1/node_modules/micromark-util-character/index.js","../../../node_modules/.pnpm/trough@2.2.0/node_modules/trough/lib/index.js","../../../node_modules/.pnpm/unified-lint-rule@3.0.1/node_modules/unified-lint-rule/lib/index.js","../../../node_modules/.pnpm/unist-util-position@5.0.0/node_modules/unist-util-position/lib/index.js","../../../node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.js","../../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/color.node.js","../../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/index.js","../../../node_modules/.pnpm/remark-lint-no-literal-urls@4.0.1/node_modules/remark-lint-no-literal-urls/index.js","../../../node_modules/.pnpm/bail@2.0.2/node_modules/bail/index.js","../../../node_modules/.pnpm/extend@3.0.2/node_modules/extend/index.js","../../../node_modules/.pnpm/devlop@1.1.0/node_modules/devlop/lib/default.js","../../../node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.js","../../../node_modules/.pnpm/unist-util-stringify-position@4.0.0/node_modules/unist-util-stringify-position/lib/index.js","../../../node_modules/.pnpm/vfile-message@4.0.3/node_modules/vfile-message/lib/index.js","../../../node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/minurl.shared.js","../../../node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/index.js","../../../node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/callable-instance.js","../../../node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.js","../src/lint/remark-lint-adapter.ts","../src/lint/rules/bare-url.ts","../../../node_modules/.pnpm/quotation@2.0.3/node_modules/quotation/index.js","../../../node_modules/.pnpm/mdast-util-phrasing@4.1.0/node_modules/mdast-util-phrasing/lib/index.js","../../../node_modules/.pnpm/remark-lint-fenced-code-flag@4.2.0/node_modules/remark-lint-fenced-code-flag/index.js","../src/lint/rules/code-block-lang.ts","../src/lint/parse.ts","../src/lint/rules/code-block-prompt-prefix.ts","../src/lint/rules/description-required.ts","../../../node_modules/.pnpm/remark-lint-no-duplicate-headings@4.0.1/node_modules/remark-lint-no-duplicate-headings/index.js","../src/lint/rules/duplicate-heading-text.ts","../../../node_modules/.pnpm/remark-lint-emphasis-marker@4.0.1/node_modules/remark-lint-emphasis-marker/index.js","../src/lint/rules/emphasis-style.ts","../src/lint/zod-adapter.ts","../src/lint/rules/frontmatter-shape.ts","../../../node_modules/.pnpm/remark-lint-heading-increment@4.0.1/node_modules/remark-lint-heading-increment/index.js","../src/lint/rules/heading-hierarchy.ts","../../../node_modules/.pnpm/remark-lint-no-heading-punctuation@4.0.1/node_modules/remark-lint-no-heading-punctuation/index.js","../src/lint/rules/heading-punctuation.ts","../src/_internal/levenshtein.ts","../src/lint/rules/image-ref.ts","../src/lint/rules/internal-link.ts","../../../node_modules/.pnpm/remark-lint-unordered-list-marker-style@4.0.1/node_modules/remark-lint-unordered-list-marker-style/index.js","../src/lint/rules/list-marker-style.ts","../src/lint/rules/no-self-host-url.ts","../../../node_modules/.pnpm/remark-lint-no-multiple-toplevel-headings@4.0.1/node_modules/remark-lint-no-multiple-toplevel-headings/index.js","../src/lint/rules/single-h1.ts","../src/lint/rules/index.ts"],"sourcesContent":["/**\n * The diagnostic envelope — the single shape every Nimbus check flows\n * through, from build validators to authoring rules to (eventually) Vale.\n *\n * Locked in Phase 0. Extending it later is a versioned schema bump, not a\n * field tacked on in a minor — see the cross-phase invariants in the\n * authoring-lints plan. Positions are the unist `Point` Sätteri's parser\n * already emits (1-based line/column plus a character offset), so a\n * diagnostic, a `--fix` edit range, and the pretty formatter's caret all\n * read from the one AST the renderer built.\n */\n\n/**\n * The stable rule-code registry. Every code Nimbus can emit lives here,\n * tagged with the tier it belongs to:\n *\n * - `build` — a build validator. Always on, fails `astro build`, no\n * severity knob. Cannot appear in the `rules` config.\n * - `authoring`— an authoring rule. Defaults to `error`, configurable to\n * `warn` / `off`, surfaced by `nimbus-docs lint`.\n *\n * Codes are registered here even before their rule is implemented so the\n * namespace is stable and `RuleCode` stays exhaustive: importing or\n * configuring an unknown code is a typecheck failure, not a silent no-op.\n */\nexport const RULE_CODES = {\n // Build validators — won't render → fail the build.\n \"nimbus/mdx-syntax\": { kind: \"build\" },\n \"nimbus/component-pascalcase\": { kind: \"build\" },\n \"nimbus/partial-exists\": { kind: \"build\" },\n \"nimbus/duplicate-slug\": { kind: \"build\" },\n\n // Authoring rules — renders fine, shouldn't ship.\n \"nimbus/frontmatter-shape\": { kind: \"authoring\" },\n \"nimbus/description-required\": { kind: \"authoring\" },\n \"nimbus/internal-link\": { kind: \"authoring\" },\n \"nimbus/image-ref\": { kind: \"authoring\" },\n \"nimbus/orphan-page\": { kind: \"authoring\" },\n \"nimbus/sidebar-entry\": { kind: \"authoring\" },\n \"nimbus/single-h1\": { kind: \"authoring\" },\n \"nimbus/heading-hierarchy\": { kind: \"authoring\" },\n \"nimbus/code-block-lang\": { kind: \"authoring\" },\n \"nimbus/code-block-prompt-prefix\": { kind: \"authoring\" },\n \"nimbus/no-self-host-url\": { kind: \"authoring\" },\n \"nimbus/heading-punctuation\": { kind: \"authoring\" },\n \"nimbus/duplicate-heading-text\": { kind: \"authoring\" },\n \"nimbus/list-marker-style\": { kind: \"authoring\" },\n \"nimbus/emphasis-style\": { kind: \"authoring\" },\n \"nimbus/bare-url\": { kind: \"authoring\" },\n} as const satisfies Record<string, { kind: \"build\" | \"authoring\" }>;\n\n/** Every rule code Nimbus knows about. */\nexport type RuleCode = keyof typeof RULE_CODES;\n\n/**\n * Authoring-rule codes only — the subset that's user-configurable via\n * `rules: { ... }`. Build validators are excluded at the type level so\n * TS-using consumers can't write the invalid config the runtime would\n * throw on, and so autocomplete inside `astro.config.ts` never offers\n * `nimbus/mdx-syntax` and friends.\n */\nexport type AuthoringRuleCode = {\n [K in RuleCode]: (typeof RULE_CODES)[K] extends { kind: \"authoring\" }\n ? K\n : never;\n}[RuleCode];\n\n/** Resolved severity — a rule that resolved to `off` never runs, so it\n * never reaches a `Diagnostic`. */\nexport type Severity = \"error\" | \"warn\";\n\n/** Severity as a user configures it. `off` disables the rule entirely. */\nexport type SeverityConfig = Severity | \"off\";\n\nexport interface DiagnosticFix {\n /** Human/agent-readable description of what the fix does. */\n description: string;\n /**\n * Edits to apply, as `[start, end]` character offsets into the source\n * (unist offsets — the same the AST reports), with replacement text.\n */\n edits: Array<{ range: [number, number]; text: string }>;\n}\n\nexport interface Diagnostic {\n code: RuleCode;\n severity: Severity;\n /** Which tool produced this. Reserved so Phase 4 can merge Vale into the\n * same envelope without a breaking change. */\n source: \"docs-compiler\" | \"vale\";\n message: string;\n /** Path relative to the project root. */\n file: string;\n /** 1-based, from the Sätteri AST. */\n line: number;\n /** 1-based, from the Sätteri AST. */\n column: number;\n endLine?: number;\n endColumn?: number;\n fix?: DiagnosticFix;\n}\n\n/** True when `code` is a build validator (unconfigurable, build-failing). */\nexport function isBuildValidator(code: RuleCode): boolean {\n return RULE_CODES[code].kind === \"build\";\n}\n\n/** Every known authoring-rule code. */\nexport function authoringRuleCodes(): RuleCode[] {\n return (Object.keys(RULE_CODES) as RuleCode[]).filter(\n (c) => RULE_CODES[c].kind === \"authoring\",\n );\n}\n\n/** Type guard: is `value` a registered rule code? */\nexport function isRuleCode(value: string): value is RuleCode {\n return Object.prototype.hasOwnProperty.call(RULE_CODES, value);\n}\n","/**\n * Lint configuration: the user-facing `rules` shape, severity resolution\n * for the engine, and the integration-side validator that enforces the\n * build/lint split at config time.\n *\n * The build / lint split is enforced here, not by convention: setting a\n * severity on a build validator, or using the reserved `collections` key,\n * is a typed, message-bearing failure — never a silent no-op.\n */\n\nimport {\n RULE_CODES,\n authoringRuleCodes,\n isBuildValidator,\n isRuleCode,\n type AuthoringRuleCode,\n type RuleCode,\n type SeverityConfig,\n} from \"./diagnostic.js\";\n\n/** A single rule's config: a bare severity, or `[severity, options]`. */\nexport type RuleSetting =\n | SeverityConfig\n | [SeverityConfig, Record<string, unknown>];\n\n/**\n * The `rules` option: authoring code → setting. Build validators don't appear\n * here — they have no severity knob (the runtime validator throws on misuse,\n * the type prevents the misuse from being writable in the first place).\n */\nexport type RulesConfig = Partial<Record<AuthoringRuleCode, RuleSetting>>;\n\n/** Per-collection lint config — currently just `rules` overrides. */\nexport interface CollectionLintConfig {\n rules?: RulesConfig;\n}\n\n/**\n * The `collections` option: collection name → per-collection overrides.\n * Each entry's `rules` shallow-merges over the top-level `rules` for\n * files in that collection. Per-rule resolution precedence is:\n * top-level defaults → per-collection → per-file `nimbusDisableRules`\n * → per-line inline disable. Each layer narrows scope.\n */\nexport type CollectionsConfig = Record<string, CollectionLintConfig>;\n\nexport interface ResolvedRule {\n severity: SeverityConfig;\n options: Record<string, unknown>;\n}\n\n/**\n * Default for an authoring rule with no explicit config: **off**. Nimbus\n * is opt-in by design — `rules: {}` means \"no authoring rules run\"; the\n * project enables what it wants. The scaffolded starter ships with\n * `nimbus/frontmatter-shape` and `nimbus/internal-link` turned on in its\n * `astro.config.ts`, visible and editable.\n *\n * The `--rule=<code>` CLI flag overrides this for the targeted rule (see\n * `engine.ts`) — otherwise running the CLI to inspect an off-by-default\n * rule would silently print nothing.\n */\nconst DEFAULT_AUTHORING_SEVERITY: SeverityConfig = \"off\";\n\n/** Resolve the effective severity + options for an authoring rule. */\nexport function resolveRule(code: AuthoringRuleCode, rules: RulesConfig): ResolvedRule {\n const setting = rules[code];\n if (setting === undefined) {\n return { severity: DEFAULT_AUTHORING_SEVERITY, options: {} };\n }\n if (Array.isArray(setting)) {\n return { severity: setting[0], options: setting[1] ?? {} };\n }\n return { severity: setting, options: {} };\n}\n\n/**\n * Resolve a rule with an optional per-collection override layer.\n * Shallow-merges per rule code — a collection-level setting fully\n * replaces the top-level one for that code, options included (we don't\n * deep-merge option bags, since a partial override would silently drop\n * defaults the user can't see). The caller passes `collection` from\n * `file.collection`; when null or unconfigured, behaves like\n * `resolveRule` over just the top-level config.\n */\nexport function resolveRuleForCollection(\n code: AuthoringRuleCode,\n rules: RulesConfig,\n collections: CollectionsConfig,\n collection: string | null,\n): ResolvedRule {\n const collectionRules =\n (collection !== null && collections[collection]?.rules) || undefined;\n if (collectionRules && code in collectionRules) {\n return resolveRule(code, collectionRules);\n }\n return resolveRule(code, rules);\n}\n\nexport interface ValidatedLintOptions {\n rules: RulesConfig;\n collections: CollectionsConfig;\n}\n\n/**\n * Validate the lint half of the integration options\n * (`nimbus(config, { rules, collections })`). Throws a content-author\n * readable error on the first structural problem. Returns the normalized\n * `rules` config on success.\n *\n * When `implementedCodes` is supplied, also fails on authoring rules that\n * are registered in `RULE_CODES` but not yet wired to a rule module —\n * configuring a non-existent rule is a footgun (silent no-op) that should\n * surface as a typed error, not be discovered later when the rule never\n * fires. The caller (the integration) passes `IMPLEMENTED_CODES` here;\n * standalone callers (the CLI's own materialized-config loader, tests\n * exercising shape validation) may omit it.\n */\nexport function validateLintOptions(input: {\n rules?: unknown;\n collections?: unknown;\n}, implementedCodes?: ReadonlySet<RuleCode>): ValidatedLintOptions {\n const rules = validateRulesBlock(input.rules, \"rules\", implementedCodes);\n const collections = validateCollectionsBlock(\n input.collections,\n implementedCodes,\n );\n return { rules, collections };\n}\n\n/**\n * Validate a `rules` block — used both for the top-level `rules` option\n * and the per-collection `collections.<name>.rules` block. `where`\n * identifies the block in error messages so the user knows which one to\n * fix (e.g. `rules` vs `collections.docs.rules`).\n */\nfunction validateRulesBlock(\n rawRules: unknown,\n where: string,\n implementedCodes: ReadonlySet<RuleCode> | undefined,\n): RulesConfig {\n if (rawRules === undefined) return {};\n if (typeof rawRules !== \"object\" || rawRules === null || Array.isArray(rawRules)) {\n throw new Error(\n `nimbus-docs: \\`${where}\\` must be an object mapping rule codes to a severity (\"error\" | \"warn\" | \"off\") or a [severity, options] tuple.`,\n );\n }\n\n const rules = rawRules as Record<string, unknown>;\n for (const [code, setting] of Object.entries(rules)) {\n if (!isRuleCode(code)) {\n throw new Error(\n `nimbus-docs: unknown rule code \"${code}\" in \\`${where}\\`. ` +\n `Valid authoring rules: ${authoringRuleCodes().join(\", \")}.`,\n );\n }\n if (isBuildValidator(code)) {\n throw new Error(\n `nimbus-docs: \"${code}\" is a build validator — it has no severity knob and can't appear in \\`${where}\\`. ` +\n \"It either passes or the build fails. To skip it on a specific file, use a per-file `nimbusDisableRules` entry or an inline disable comment instead.\",\n );\n }\n const severity = Array.isArray(setting) ? setting[0] : setting;\n if (severity !== \"error\" && severity !== \"warn\" && severity !== \"off\") {\n throw new Error(\n `nimbus-docs: \"${code}\" in \\`${where}\\` has an invalid severity ${JSON.stringify(severity)}. Use \"error\", \"warn\", or \"off\"` +\n ' (optionally as a tuple: [\"error\", { /* options */ }]).',\n );\n }\n if (Array.isArray(setting) && setting[1] !== undefined &&\n (typeof setting[1] !== \"object\" || setting[1] === null)) {\n throw new Error(\n `nimbus-docs: the options half of the tuple for \"${code}\" in \\`${where}\\` must be an object, e.g. [\"error\", { allow: [\"mermaid\"] }].`,\n );\n }\n if (implementedCodes && !implementedCodes.has(code) && severity !== \"off\") {\n throw new Error(\n `nimbus-docs: \"${code}\" is registered but not yet implemented — configuring it as \"${severity}\" in \\`${where}\\` would silently do nothing. ` +\n \"Remove the entry, or set it to \\\"off\\\" to silence the warning if you're forward-configuring for a future release.\",\n );\n }\n }\n return rules as RulesConfig;\n}\n\n/**\n * Validate the `collections` block. Each value is a `{ rules?: ... }`\n * object whose `rules` follow the same shape as the top-level `rules`\n * option — including the build-validator carve-out (build validators\n * stay global; they can't be configured per-collection).\n */\nfunction validateCollectionsBlock(\n rawCollections: unknown,\n implementedCodes: ReadonlySet<RuleCode> | undefined,\n): CollectionsConfig {\n if (rawCollections === undefined) return {};\n if (\n typeof rawCollections !== \"object\" ||\n rawCollections === null ||\n Array.isArray(rawCollections)\n ) {\n throw new Error(\n 'nimbus-docs: `collections` must be an object mapping collection names to a `{ rules: {…} }` block.',\n );\n }\n const out: CollectionsConfig = {};\n for (const [name, raw] of Object.entries(\n rawCollections as Record<string, unknown>,\n )) {\n if (typeof raw !== \"object\" || raw === null || Array.isArray(raw)) {\n throw new Error(\n `nimbus-docs: \\`collections.${name}\\` must be an object, e.g. \\`{ rules: { \"nimbus/single-h1\": \"off\" } }\\`.`,\n );\n }\n const block = raw as { rules?: unknown };\n const rules = validateRulesBlock(\n block.rules,\n `collections.${name}.rules`,\n implementedCodes,\n );\n out[name] = { rules };\n }\n return out;\n}\n\n/** Codes registered but not yet wired to a rule implementation. Used by the\n * CLI to avoid silently claiming coverage it doesn't have. */\nexport function isImplemented(code: RuleCode, implemented: ReadonlySet<RuleCode>): boolean {\n return implemented.has(code) && code in RULE_CODES;\n}\n","/**\n * @typedef {import('mdast').Nodes} Nodes\n *\n * @typedef Options\n * Configuration (optional).\n * @property {boolean | null | undefined} [includeImageAlt=true]\n * Whether to use `alt` for `image`s (default: `true`).\n * @property {boolean | null | undefined} [includeHtml=true]\n * Whether to use `value` of HTML (default: `true`).\n */\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Get the text content of a node or list of nodes.\n *\n * Prefers the node’s plain-text fields, otherwise serializes its children,\n * and if the given value is an array, serialize the nodes in it.\n *\n * @param {unknown} [value]\n * Thing to serialize, typically `Node`.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {string}\n * Serialized `value`.\n */\nexport function toString(value, options) {\n const settings = options || emptyOptions\n const includeImageAlt =\n typeof settings.includeImageAlt === 'boolean'\n ? settings.includeImageAlt\n : true\n const includeHtml =\n typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true\n\n return one(value, includeImageAlt, includeHtml)\n}\n\n/**\n * One node or several nodes.\n *\n * @param {unknown} value\n * Thing to serialize.\n * @param {boolean} includeImageAlt\n * Include image `alt`s.\n * @param {boolean} includeHtml\n * Include HTML.\n * @returns {string}\n * Serialized node.\n */\nfunction one(value, includeImageAlt, includeHtml) {\n if (node(value)) {\n if ('value' in value) {\n return value.type === 'html' && !includeHtml ? '' : value.value\n }\n\n if (includeImageAlt && 'alt' in value && value.alt) {\n return value.alt\n }\n\n if ('children' in value) {\n return all(value.children, includeImageAlt, includeHtml)\n }\n }\n\n if (Array.isArray(value)) {\n return all(value, includeImageAlt, includeHtml)\n }\n\n return ''\n}\n\n/**\n * Serialize a list of nodes.\n *\n * @param {Array<unknown>} values\n * Thing to serialize.\n * @param {boolean} includeImageAlt\n * Include image `alt`s.\n * @param {boolean} includeHtml\n * Include HTML.\n * @returns {string}\n * Serialized nodes.\n */\nfunction all(values, includeImageAlt, includeHtml) {\n /** @type {Array<string>} */\n const result = []\n let index = -1\n\n while (++index < values.length) {\n result[index] = one(values[index], includeImageAlt, includeHtml)\n }\n\n return result.join('')\n}\n\n/**\n * Check if `value` looks like a node.\n *\n * @param {unknown} value\n * Thing.\n * @returns {value is Nodes}\n * Whether `value` is a node.\n */\nfunction node(value) {\n return Boolean(value && typeof value === 'object')\n}\n","/**\n * @import {Code} from 'micromark-util-types'\n */\n\n/**\n * Check whether the character code represents an ASCII alpha (`a` through `z`,\n * case insensitive).\n *\n * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha.\n *\n * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`)\n * to U+005A (`Z`).\n *\n * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`)\n * to U+007A (`z`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiAlpha = regexCheck(/[A-Za-z]/);\n\n/**\n * Check whether the character code represents an ASCII alphanumeric (`a`\n * through `z`, case insensitive, or `0` through `9`).\n *\n * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha\n * (see `asciiAlpha`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiAlphanumeric = regexCheck(/[\\dA-Za-z]/);\n\n/**\n * Check whether the character code represents an ASCII atext.\n *\n * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in\n * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`),\n * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F\n * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E\n * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE\n * (`{`) to U+007E TILDE (`~`).\n *\n * See:\n * **\\[RFC5322]**:\n * [Internet Message Format](https://tools.ietf.org/html/rfc5322).\n * P. Resnick.\n * IETF.\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiAtext = regexCheck(/[#-'*+\\--9=?A-Z^-~]/);\n\n/**\n * Check whether a character code is an ASCII control character.\n *\n * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL)\n * to U+001F (US), or U+007F (DEL).\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport function asciiControl(code) {\n return (\n // Special whitespace codes (which have negative values), C0 and Control\n // character DEL\n code !== null && (code < 32 || code === 127)\n );\n}\n\n/**\n * Check whether the character code represents an ASCII digit (`0` through `9`).\n *\n * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to\n * U+0039 (`9`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiDigit = regexCheck(/\\d/);\n\n/**\n * Check whether the character code represents an ASCII hex digit (`a` through\n * `f`, case insensitive, or `0` through `9`).\n *\n * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex\n * digit, or an ASCII lower hex digit.\n *\n * An **ASCII upper hex digit** is a character in the inclusive range U+0041\n * (`A`) to U+0046 (`F`).\n *\n * An **ASCII lower hex digit** is a character in the inclusive range U+0061\n * (`a`) to U+0066 (`f`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiHexDigit = regexCheck(/[\\dA-Fa-f]/);\n\n/**\n * Check whether the character code represents ASCII punctuation.\n *\n * An **ASCII punctuation** is a character in the inclusive ranges U+0021\n * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT\n * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT\n * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);\n\n/**\n * Check whether a character code is a markdown line ending.\n *\n * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN\n * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR).\n *\n * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE\n * RETURN (CR) are replaced by these virtual characters depending on whether\n * they occurred together.\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport function markdownLineEnding(code) {\n return code !== null && code < -2;\n}\n\n/**\n * Check whether a character code is a markdown line ending (see\n * `markdownLineEnding`) or markdown space (see `markdownSpace`).\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport function markdownLineEndingOrSpace(code) {\n return code !== null && (code < 0 || code === 32);\n}\n\n/**\n * Check whether a character code is a markdown space.\n *\n * A **markdown space** is the concrete character U+0020 SPACE (SP) and the\n * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT).\n *\n * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is\n * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL\n * SPACE (VS) characters, depending on the column at which the tab occurred.\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nexport function markdownSpace(code) {\n return code === -2 || code === -1 || code === 32;\n}\n\n// Size note: removing ASCII from the regex and using `asciiPunctuation` here\n// In fact adds to the bundle size.\n/**\n * Check whether the character code represents Unicode punctuation.\n *\n * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation,\n * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf`\n * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po`\n * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII\n * punctuation (see `asciiPunctuation`).\n *\n * See:\n * **\\[UNICODE]**:\n * [The Unicode Standard](https://www.unicode.org/versions/).\n * Unicode Consortium.\n *\n * @param code\n * Code.\n * @returns\n * Whether it matches.\n */\nexport const unicodePunctuation = regexCheck(/\\p{P}|\\p{S}/u);\n\n/**\n * Check whether the character code represents Unicode whitespace.\n *\n * Note that this does handle micromark specific markdown whitespace characters.\n * See `markdownLineEndingOrSpace` to check that.\n *\n * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator,\n * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF),\n * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\\[UNICODE]**).\n *\n * See:\n * **\\[UNICODE]**:\n * [The Unicode Standard](https://www.unicode.org/versions/).\n * Unicode Consortium.\n *\n * @param code\n * Code.\n * @returns\n * Whether it matches.\n */\nexport const unicodeWhitespace = regexCheck(/\\s/);\n\n/**\n * Create a code check from a regex.\n *\n * @param {RegExp} regex\n * Expression.\n * @returns {(code: Code) => boolean}\n * Check.\n */\nfunction regexCheck(regex) {\n return check;\n\n /**\n * Check whether a code matches the bound regex.\n *\n * @param {Code} code\n * Character code.\n * @returns {boolean}\n * Whether the character code matches the bound regex.\n */\n function check(code) {\n return code !== null && code > -1 && regex.test(String.fromCharCode(code));\n }\n}","// To do: remove `void`s\n// To do: remove `null` from output of our APIs, allow it as user APIs.\n\n/**\n * @typedef {(error?: Error | null | undefined, ...output: Array<any>) => void} Callback\n * Callback.\n *\n * @typedef {(...input: Array<any>) => any} Middleware\n * Ware.\n *\n * @typedef Pipeline\n * Pipeline.\n * @property {Run} run\n * Run the pipeline.\n * @property {Use} use\n * Add middleware.\n *\n * @typedef {(...input: Array<any>) => void} Run\n * Call all middleware.\n *\n * Calls `done` on completion with either an error or the output of the\n * last middleware.\n *\n * > 👉 **Note**: as the length of input defines whether async functions get a\n * > `next` function,\n * > it’s recommended to keep `input` at one value normally.\n\n *\n * @typedef {(fn: Middleware) => Pipeline} Use\n * Add middleware.\n */\n\n/**\n * Create new middleware.\n *\n * @returns {Pipeline}\n * Pipeline.\n */\nexport function trough() {\n /** @type {Array<Middleware>} */\n const fns = []\n /** @type {Pipeline} */\n const pipeline = {run, use}\n\n return pipeline\n\n /** @type {Run} */\n function run(...values) {\n let middlewareIndex = -1\n /** @type {Callback} */\n const callback = values.pop()\n\n if (typeof callback !== 'function') {\n throw new TypeError('Expected function as last argument, not ' + callback)\n }\n\n next(null, ...values)\n\n /**\n * Run the next `fn`, or we’re done.\n *\n * @param {Error | null | undefined} error\n * @param {Array<any>} output\n */\n function next(error, ...output) {\n const fn = fns[++middlewareIndex]\n let index = -1\n\n if (error) {\n callback(error)\n return\n }\n\n // Copy non-nullish input into values.\n while (++index < values.length) {\n if (output[index] === null || output[index] === undefined) {\n output[index] = values[index]\n }\n }\n\n // Save the newly created `output` for the next call.\n values = output\n\n // Next or done.\n if (fn) {\n wrap(fn, next)(...output)\n } else {\n callback(null, ...output)\n }\n }\n }\n\n /** @type {Use} */\n function use(middelware) {\n if (typeof middelware !== 'function') {\n throw new TypeError(\n 'Expected `middelware` to be a function, not ' + middelware\n )\n }\n\n fns.push(middelware)\n return pipeline\n }\n}\n\n/**\n * Wrap `middleware` into a uniform interface.\n *\n * You can pass all input to the resulting function.\n * `callback` is then called with the output of `middleware`.\n *\n * If `middleware` accepts more arguments than the later given in input,\n * an extra `done` function is passed to it after that input,\n * which must be called by `middleware`.\n *\n * The first value in `input` is the main input value.\n * All other input values are the rest input values.\n * The values given to `callback` are the input values,\n * merged with every non-nullish output value.\n *\n * * if `middleware` throws an error,\n * returns a promise that is rejected,\n * or calls the given `done` function with an error,\n * `callback` is called with that error\n * * if `middleware` returns a value or returns a promise that is resolved,\n * that value is the main output value\n * * if `middleware` calls `done`,\n * all non-nullish values except for the first one (the error) overwrite the\n * output values\n *\n * @param {Middleware} middleware\n * Function to wrap.\n * @param {Callback} callback\n * Callback called with the output of `middleware`.\n * @returns {Run}\n * Wrapped middleware.\n */\nexport function wrap(middleware, callback) {\n /** @type {boolean} */\n let called\n\n return wrapped\n\n /**\n * Call `middleware`.\n * @this {any}\n * @param {Array<any>} parameters\n * @returns {void}\n */\n function wrapped(...parameters) {\n const fnExpectsCallback = middleware.length > parameters.length\n /** @type {any} */\n let result\n\n if (fnExpectsCallback) {\n parameters.push(done)\n }\n\n try {\n result = middleware.apply(this, parameters)\n } catch (error) {\n const exception = /** @type {Error} */ (error)\n\n // Well, this is quite the pickle.\n // `middleware` received a callback and called it synchronously, but that\n // threw an error.\n // The only thing left to do is to throw the thing instead.\n if (fnExpectsCallback && called) {\n throw exception\n }\n\n return done(exception)\n }\n\n if (!fnExpectsCallback) {\n if (result && result.then && typeof result.then === 'function') {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n /**\n * Call `callback`, only once.\n *\n * @type {Callback}\n */\n function done(error, ...output) {\n if (!called) {\n called = true\n callback(error, ...output)\n }\n }\n\n /**\n * Call `done` with one value.\n *\n * @param {any} [value]\n */\n function then(value) {\n done(null, value)\n }\n}\n","/**\n * @import {TransformCallback} from 'unified'\n * @import {Plugin, Rule} from 'unified-lint-rule'\n * @import {Node} from 'unist'\n * @import {VFile} from 'vfile'\n */\n\n/**\n * @typedef {'error' | 'on' | 'off' | 'warn'} Label\n * Severity label;\n * `'off'`: `0`, `'on'` and `warn`: `1`, `'error'`: `2`.\n *\n * @typedef Meta\n * Rule metadata.\n * @property {string} origin\n * Name of the lint rule.\n * @property {string | null | undefined} [url]\n * Link to documentation (optional).\n *\n * @typedef {0 | 1 | 2} Severity\n * Severity number;\n * `0`: `'off'`, `1`: `'on'` and `warn`, `2`: `'error'`.\n */\n\nimport {wrap} from 'trough'\n\n/**\n * @template {Node} [Tree=Node]\n * Node kind.\n * @template {unknown} [Option=unknown]\n * Parameter kind.\n * @param {Meta | string} meta\n * Info.\n * @param {Rule<Tree, Option>} rule\n * Rule.\n * @returns {Plugin<Tree, Option>}\n * Plugin.\n */\nexport function lintRule(meta, rule) {\n const id = typeof meta === 'string' ? meta : meta.origin\n const url = typeof meta === 'string' ? undefined : meta.url\n const parts = id.split(':')\n /* c8 ignore next -- Possibly useful if externalised later. */\n const source = parts[1] ? parts[0] : undefined\n const ruleId = parts[1]\n\n Object.defineProperty(plugin, 'name', {value: id})\n\n return plugin\n\n /**\n * @param {[level: Label | Severity | boolean, option?: Option] | Label | Option | Severity} [config]\n * Config.\n * @returns\n * Transform, if on.\n */\n function plugin(config) {\n const [severity, options] = coerce(ruleId, config)\n\n const fatal = severity === 2\n\n if (!severity) return\n\n /**\n * @param {Tree} tree\n * Tree.\n * @param {VFile} file\n * File.\n * @param {TransformCallback<Tree>} next\n * Next.\n * @returns {undefined}\n * Nothing.\n */\n return function (tree, file, next) {\n let index = file.messages.length - 1\n\n wrap(rule, function (error) {\n const messages = file.messages\n\n /* c8 ignore next 8 -- add the error,\n * if not already properly added.\n * Only happens for incorrect plugins. */\n // @ts-expect-error: errors could be `messages`.\n if (error && !messages.includes(error)) {\n try {\n file.fail(error)\n } catch {}\n }\n\n while (++index < messages.length) {\n Object.assign(messages[index], {fatal, ruleId, source, url})\n }\n\n next()\n })(tree, file, options)\n }\n }\n}\n\n/**\n * Coerce a value to a severity--options tuple.\n *\n * @template {unknown} [Option=unknown]\n * Parameter kind.\n * @param {string} name\n * Rule name.\n * @param {[level: Label | Severity | boolean, option?: Option] | Option} config\n * Configuration.\n * @returns {[severity: Severity, parameter: Option | undefined]}\n * Severity and options.\n */\nfunction coerce(name, config) {\n if (Array.isArray(config)) {\n const [severity, option] = config\n\n switch (severity) {\n case false:\n case 0:\n case 'off': {\n return [0, option]\n }\n\n case true:\n case 1:\n case 'on':\n case 'warn': {\n return [1, option]\n }\n\n case 2:\n case 'error': {\n return [2, option]\n }\n\n default: {\n if (typeof severity === 'number') {\n throw new Error(\n 'Incorrect severity `' +\n severity +\n '` for `' +\n name +\n '`, ' +\n 'expected 0, 1, or 2'\n )\n }\n\n // If we do not know the 1st item of the array,\n // and it’s not a number,\n // assume `config` is *meant* as an array.\n return [1, /** @type {Option} */ (config)]\n }\n }\n }\n\n return [1, config]\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Point} Point\n * @typedef {import('unist').Position} Position\n */\n\n/**\n * @typedef NodeLike\n * @property {string} type\n * @property {PositionLike | null | undefined} [position]\n *\n * @typedef PositionLike\n * @property {PointLike | null | undefined} [start]\n * @property {PointLike | null | undefined} [end]\n *\n * @typedef PointLike\n * @property {number | null | undefined} [line]\n * @property {number | null | undefined} [column]\n * @property {number | null | undefined} [offset]\n */\n\n/**\n * Get the ending point of `node`.\n *\n * @param node\n * Node.\n * @returns\n * Point.\n */\nexport const pointEnd = point('end')\n\n/**\n * Get the starting point of `node`.\n *\n * @param node\n * Node.\n * @returns\n * Point.\n */\nexport const pointStart = point('start')\n\n/**\n * Get the positional info of `node`.\n *\n * @param {'end' | 'start'} type\n * Side.\n * @returns\n * Getter.\n */\nfunction point(type) {\n return point\n\n /**\n * Get the point info of `node` at a bound side.\n *\n * @param {Node | NodeLike | null | undefined} [node]\n * @returns {Point | undefined}\n */\n function point(node) {\n const point = (node && node.position && node.position[type]) || {}\n\n if (\n typeof point.line === 'number' &&\n point.line > 0 &&\n typeof point.column === 'number' &&\n point.column > 0\n ) {\n return {\n line: point.line,\n column: point.column,\n offset:\n typeof point.offset === 'number' && point.offset > -1\n ? point.offset\n : undefined\n }\n }\n }\n}\n\n/**\n * Get the positional info of `node`.\n *\n * @param {Node | NodeLike | null | undefined} [node]\n * Node.\n * @returns {Position | undefined}\n * Position.\n */\nexport function position(node) {\n const start = pointStart(node)\n const end = pointEnd(node)\n\n if (start && end) {\n return {start, end}\n }\n}\n","/**\n * @import {Node, Parent} from 'unist'\n */\n\n/**\n * @template Fn\n * @template Fallback\n * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate\n */\n\n/**\n * @callback Check\n * Check that an arbitrary value is a node.\n * @param {unknown} this\n * The given context.\n * @param {unknown} [node]\n * Anything (typically a node).\n * @param {number | null | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | null | undefined} [parent]\n * The node’s parent.\n * @returns {boolean}\n * Whether this is a node and passes a test.\n *\n * @typedef {Record<string, unknown> | Node} Props\n * Object to check for equivalence.\n *\n * Note: `Node` is included as it is common but is not indexable.\n *\n * @typedef {Array<Props | TestFunction | string> | ReadonlyArray<Props | TestFunction | string> | Props | TestFunction | string | null | undefined} Test\n * Check for an arbitrary node.\n *\n * @callback TestFunction\n * Check if a node passes a test.\n * @param {unknown} this\n * The given context.\n * @param {Node} node\n * A node.\n * @param {number | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | undefined} [parent]\n * The node’s parent.\n * @returns {boolean | undefined | void}\n * Whether this node passes the test.\n *\n * Note: `void` is included until TS sees no return as `undefined`.\n */\n\n/**\n * Check if `node` is a `Node` and whether it passes the given test.\n *\n * @param {unknown} node\n * Thing to check, typically `Node`.\n * @param {Test} test\n * A check for a specific node.\n * @param {number | null | undefined} index\n * The node’s position in its parent.\n * @param {Parent | null | undefined} parent\n * The node’s parent.\n * @param {unknown} context\n * Context object (`this`) to pass to `test` functions.\n * @returns {boolean}\n * Whether `node` is a node and passes a test.\n */\nexport const is =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * (<Condition extends ReadonlyArray<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &\n * (<Condition extends Array<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &\n * (<Condition extends string>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * (<Condition extends Props>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * (<Condition extends TestFunction>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &\n * ((node?: null | undefined) => false) &\n * ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean)\n * )}\n */\n (\n /**\n * @param {unknown} [node]\n * @param {Test} [test]\n * @param {number | null | undefined} [index]\n * @param {Parent | null | undefined} [parent]\n * @param {unknown} [context]\n * @returns {boolean}\n */\n // eslint-disable-next-line max-params\n function (node, test, index, parent, context) {\n const check = convert(test)\n\n if (\n index !== undefined &&\n index !== null &&\n (typeof index !== 'number' ||\n index < 0 ||\n index === Number.POSITIVE_INFINITY)\n ) {\n throw new Error('Expected positive finite index')\n }\n\n if (\n parent !== undefined &&\n parent !== null &&\n (!is(parent) || !parent.children)\n ) {\n throw new Error('Expected parent node')\n }\n\n if (\n (parent === undefined || parent === null) !==\n (index === undefined || index === null)\n ) {\n throw new Error('Expected both parent and index')\n }\n\n return looksLikeANode(node)\n ? check.call(context, node, index, parent)\n : false\n }\n )\n\n/**\n * Generate an assertion from a test.\n *\n * Useful if you’re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * a `node`, `index`, and `parent`.\n *\n * @param {Test} test\n * * when nullish, checks if `node` is a `Node`.\n * * when `string`, works like passing `(node) => node.type === test`.\n * * when `function` checks if function passed the node is true.\n * * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.\n * * when `array`, checks if any one of the subtests pass.\n * @returns {Check}\n * An assertion.\n */\nexport const convert =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &\n * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((test?: Test) => Check)\n * )}\n */\n (\n /**\n * @param {Test} [test]\n * @returns {Check}\n */\n function (test) {\n if (test === null || test === undefined) {\n return ok\n }\n\n if (typeof test === 'function') {\n return castFactory(test)\n }\n\n if (typeof test === 'object') {\n return Array.isArray(test)\n ? anyFactory(test)\n : // Cast because `ReadonlyArray` goes into the above but `isArray`\n // narrows to `Array`.\n propertiesFactory(/** @type {Props} */ (test))\n }\n\n if (typeof test === 'string') {\n return typeFactory(test)\n }\n\n throw new Error('Expected function, string, or object as test')\n }\n )\n\n/**\n * @param {Array<Props | TestFunction | string>} tests\n * @returns {Check}\n */\nfunction anyFactory(tests) {\n /** @type {Array<Check>} */\n const checks = []\n let index = -1\n\n while (++index < tests.length) {\n checks[index] = convert(tests[index])\n }\n\n return castFactory(any)\n\n /**\n * @this {unknown}\n * @type {TestFunction}\n */\n function any(...parameters) {\n let index = -1\n\n while (++index < checks.length) {\n if (checks[index].apply(this, parameters)) return true\n }\n\n return false\n }\n}\n\n/**\n * Turn an object into a test for a node with a certain fields.\n *\n * @param {Props} check\n * @returns {Check}\n */\nfunction propertiesFactory(check) {\n const checkAsRecord = /** @type {Record<string, unknown>} */ (check)\n\n return castFactory(all)\n\n /**\n * @param {Node} node\n * @returns {boolean}\n */\n function all(node) {\n const nodeAsRecord = /** @type {Record<string, unknown>} */ (\n /** @type {unknown} */ (node)\n )\n\n /** @type {string} */\n let key\n\n for (key in check) {\n if (nodeAsRecord[key] !== checkAsRecord[key]) return false\n }\n\n return true\n }\n}\n\n/**\n * Turn a string into a test for a node with a certain type.\n *\n * @param {string} check\n * @returns {Check}\n */\nfunction typeFactory(check) {\n return castFactory(type)\n\n /**\n * @param {Node} node\n */\n function type(node) {\n return node && node.type === check\n }\n}\n\n/**\n * Turn a custom test into a test for a node that passes that test.\n *\n * @param {TestFunction} testFunction\n * @returns {Check}\n */\nfunction castFactory(testFunction) {\n return check\n\n /**\n * @this {unknown}\n * @type {Check}\n */\n function check(value, index, parent) {\n return Boolean(\n looksLikeANode(value) &&\n testFunction.call(\n this,\n value,\n typeof index === 'number' ? index : undefined,\n parent || undefined\n )\n )\n }\n}\n\nfunction ok() {\n return true\n}\n\n/**\n * @param {unknown} value\n * @returns {value is Node}\n */\nfunction looksLikeANode(value) {\n return value !== null && typeof value === 'object' && 'type' in value\n}\n","/**\n * @param {string} d\n * @returns {string}\n */\nexport function color(d) {\n return '\\u001B[33m' + d + '\\u001B[39m'\n}\n","/**\n * @import {Node as UnistNode, Parent as UnistParent} from 'unist'\n */\n\n/**\n * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test\n * Test from `unist-util-is`.\n *\n * Note: we have remove and add `undefined`, because otherwise when generating\n * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n * which doesn’t work when publishing on npm.\n */\n\n/**\n * @typedef {(\n * Fn extends (value: any) => value is infer Thing\n * ? Thing\n * : Fallback\n * )} Predicate\n * Get the value of a type guard `Fn`.\n * @template Fn\n * Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n * Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n * Check extends null | undefined // No test.\n * ? Value\n * : Value extends {type: Check} // String (type) test.\n * ? Value\n * : Value extends Check // Partial test.\n * ? Value\n * : Check extends Function // Function test.\n * ? Predicate<Check, Value> extends Value\n * ? Predicate<Check, Value>\n * : never\n * : never // Some other test?\n * )} MatchesOne\n * Check whether a node matches a primitive check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n * Check extends ReadonlyArray<infer T>\n * ? MatchesOne<Value, T>\n * : Check extends Array<infer T>\n * ? MatchesOne<Value, T>\n * : MatchesOne<Value, Check>\n * )} Matches\n * Check whether a node matches a check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n * Number; capped reasonably.\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n * Increment a number in the type system.\n * @template {Uint} [I=0]\n * Index.\n */\n\n/**\n * @typedef {(\n * Node extends UnistParent\n * ? Node extends {children: Array<infer Children>}\n * ? Child extends Children ? Node : never\n * : never\n * : never\n * )} InternalParent\n * Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {InternalParent<InclusiveDescendant<Tree>, Child>} Parent\n * Collect nodes in `Tree` that can be parents of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Depth extends Max\n * ? never\n * :\n * | InternalParent<Node, Child>\n * | InternalAncestor<Node, InternalParent<Node, Child>, Max, Increment<Depth>>\n * )} InternalAncestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {InternalAncestor<InclusiveDescendant<Tree>, Child>} Ancestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Tree extends UnistParent\n * ? Depth extends Max\n * ? Tree\n * : Tree | InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>\n * : Tree\n * )} InclusiveDescendant\n * Collect all (inclusive) descendants of `Tree`.\n *\n * > 👉 **Note**: for performance reasons, this seems to be the fastest way to\n * > recurse without actually running into an infinite loop, which the\n * > previous version did.\n * >\n * > Practically, a max of `2` is typically enough assuming a `Root` is\n * > passed, but it doesn’t improve performance.\n * > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n * > Using up to `10` doesn’t hurt or help either.\n * @template {UnistNode} Tree\n * Tree type.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {'skip' | boolean} Action\n * Union of the action types.\n *\n * @typedef {number} Index\n * Move to the sibling at `index` next (after node itself is completely\n * traversed).\n *\n * Useful if mutating the tree, such as removing the node the visitor is\n * currently on, or any of its previous siblings.\n * Results less than 0 or greater than or equal to `children.length` stop\n * traversing the parent.\n *\n * @typedef {[(Action | null | undefined | void)?, (Index | null | undefined)?]} ActionTuple\n * List with one or two values, the first an action, the second an index.\n *\n * @typedef {Action | ActionTuple | Index | null | undefined | void} VisitorResult\n * Any value that can be returned from a visitor.\n */\n\n/**\n * @callback Visitor\n * Handle a node (matching `test`, if given).\n *\n * Visitors are free to transform `node`.\n * They can also transform the parent of node (the last of `ancestors`).\n *\n * Replacing `node` itself, if `SKIP` is not returned, still causes its\n * descendants to be walked (which is a bug).\n *\n * When adding or removing previous siblings of `node` (or next siblings, in\n * case of reverse), the `Visitor` should return a new `Index` to specify the\n * sibling to traverse after `node` is traversed.\n * Adding or removing next siblings of `node` (or previous siblings, in case\n * of reverse) is handled as expected without needing to return a new `Index`.\n *\n * Removing the children property of an ancestor still results in them being\n * traversed.\n * @param {Visited} node\n * Found node.\n * @param {Array<VisitedParents>} ancestors\n * Ancestors of `node`.\n * @returns {VisitorResult}\n * What to do next.\n *\n * An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n * An `Action` is treated as a tuple of `[Action]`.\n *\n * Passing a tuple back only makes sense if the `Action` is `SKIP`.\n * When the `Action` is `EXIT`, that action can be returned.\n * When the `Action` is `CONTINUE`, `Index` can be returned.\n * @template {UnistNode} [Visited=UnistNode]\n * Visited node type.\n * @template {UnistParent} [VisitedParents=UnistParent]\n * Ancestor type.\n */\n\n/**\n * @typedef {Visitor<Matches<InclusiveDescendant<Tree>, Check>, Ancestor<Tree, Matches<InclusiveDescendant<Tree>, Check>>>} BuildVisitor\n * Build a typed `Visitor` function from a tree and a test.\n *\n * It will infer which values are passed as `node` and which as `parents`.\n * @template {UnistNode} [Tree=UnistNode]\n * Tree type.\n * @template {Test} [Check=Test]\n * Test type.\n */\n\nimport {convert} from 'unist-util-is'\nimport {color} from 'unist-util-visit-parents/do-not-use-color'\n\n/** @type {Readonly<ActionTuple>} */\nconst empty = []\n\n/**\n * Continue traversing as normal.\n */\nexport const CONTINUE = true\n\n/**\n * Stop traversing immediately.\n */\nexport const EXIT = false\n\n/**\n * Do not traverse this node’s children.\n */\nexport const SKIP = 'skip'\n\n/**\n * Visit nodes, with ancestral information.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @overload\n * @param {Tree} tree\n * @param {Check} check\n * @param {BuildVisitor<Tree, Check>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @overload\n * @param {Tree} tree\n * @param {BuildVisitor<Tree>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @param {UnistNode} tree\n * Tree to traverse.\n * @param {Visitor | Test} test\n * `unist-util-is`-compatible test\n * @param {Visitor | boolean | null | undefined} [visitor]\n * Handle each node.\n * @param {boolean | null | undefined} [reverse]\n * Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns {undefined}\n * Nothing.\n *\n * @template {UnistNode} Tree\n * Node type.\n * @template {Test} Check\n * `unist-util-is`-compatible test.\n */\nexport function visitParents(tree, test, visitor, reverse) {\n /** @type {Test} */\n let check\n\n if (typeof test === 'function' && typeof visitor !== 'function') {\n reverse = visitor\n // @ts-expect-error no visitor given, so `visitor` is test.\n visitor = test\n } else {\n // @ts-expect-error visitor given, so `test` isn’t a visitor.\n check = test\n }\n\n const is = convert(check)\n const step = reverse ? -1 : 1\n\n factory(tree, undefined, [])()\n\n /**\n * @param {UnistNode} node\n * @param {number | undefined} index\n * @param {Array<UnistParent>} parents\n */\n function factory(node, index, parents) {\n const value = /** @type {Record<string, unknown>} */ (\n node && typeof node === 'object' ? node : {}\n )\n\n if (typeof value.type === 'string') {\n const name =\n // `hast`\n typeof value.tagName === 'string'\n ? value.tagName\n : // `xast`\n typeof value.name === 'string'\n ? value.name\n : undefined\n\n Object.defineProperty(visit, 'name', {\n value:\n 'node (' + color(node.type + (name ? '<' + name + '>' : '')) + ')'\n })\n }\n\n return visit\n\n function visit() {\n /** @type {Readonly<ActionTuple>} */\n let result = empty\n /** @type {Readonly<ActionTuple>} */\n let subresult\n /** @type {number} */\n let offset\n /** @type {Array<UnistParent>} */\n let grandparents\n\n if (!test || is(node, index, parents[parents.length - 1] || undefined)) {\n // @ts-expect-error: `visitor` is now a visitor.\n result = toResult(visitor(node, parents))\n\n if (result[0] === EXIT) {\n return result\n }\n }\n\n if ('children' in node && node.children) {\n const nodeAsParent = /** @type {UnistParent} */ (node)\n\n if (nodeAsParent.children && result[0] !== SKIP) {\n offset = (reverse ? nodeAsParent.children.length : -1) + step\n grandparents = parents.concat(nodeAsParent)\n\n while (offset > -1 && offset < nodeAsParent.children.length) {\n const child = nodeAsParent.children[offset]\n\n subresult = factory(child, offset, grandparents)()\n\n if (subresult[0] === EXIT) {\n return subresult\n }\n\n offset =\n typeof subresult[1] === 'number' ? subresult[1] : offset + step\n }\n }\n }\n\n return result\n }\n }\n}\n\n/**\n * Turn a return value into a clean result.\n *\n * @param {VisitorResult} value\n * Valid return values from visitors.\n * @returns {Readonly<ActionTuple>}\n * Clean result.\n */\nfunction toResult(value) {\n if (Array.isArray(value)) {\n return value\n }\n\n if (typeof value === 'number') {\n return [CONTINUE, value]\n }\n\n return value === null || value === undefined ? empty : [value]\n}\n","/**\n * remark-lint rule to warn when GFM autolink literals are used.\n *\n * ## What is this?\n *\n * This package checks that regular autolinks or full links are used.\n * Literal autolinks is a GFM feature enabled with\n * [`remark-gfm`][github-remark-gfm].\n *\n * ## When should I use this?\n *\n * You can use this package to check that links are consistent.\n *\n * ## API\n *\n * ### `unified().use(remarkLintNoLiteralUrls)`\n *\n * Warn when GFM autolink literals are used.\n *\n * ###### Parameters\n *\n * There are no options.\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * ## Recommendation\n *\n * GFM autolink literals (just a raw URL) are a feature enabled by GFM.\n * They don’t work everywhere.\n * So,\n * it’s recommended to instead use regular autolinks (`<https://url>`) or full\n * links (`[text](url)`).\n *\n * ## Fix\n *\n * [`remark-stringify`][github-remark-stringify] never generates GFM autolink\n * literals.\n * It always generates regular autolinks or full links.\n *\n * [api-remark-lint-no-literal-urls]: #unifieduseremarklintnoliteralurls\n * [github-remark-gfm]: https://github.com/remarkjs/remark-gfm\n * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify\n * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\n *\n * @module no-literal-urls\n * @author Titus Wormer\n * @copyright Titus Wormer\n * @license MIT\n *\n * @example\n * {\"name\": \"ok.md\", \"gfm\": true}\n *\n * <https://example.com/mercury/>\n *\n * .\n *\n * @example\n * {\"name\": \"not-ok.md\", \"label\": \"input\", \"gfm\": true}\n *\n * https://example.com/mercury/\n *\n * www.example.com/venus/\n *\n * earth@mars.planets\n *\n * @example\n * {\"name\": \"not-ok.md\", \"label\": \"output\", \"gfm\": true}\n *\n * 1:1-1:29: Unexpected GFM autolink literal, expected regular autolink, add `<` before and `>` after\n * 3:1-3:23: Unexpected GFM autolink literal, expected regular autolink, add `<http://` before and `>` after\n * 5:1-5:19: Unexpected GFM autolink literal, expected regular autolink, add `<mailto:` before and `>` after\n */\n\n/**\n * @import {Root} from 'mdast'\n */\n\nimport {toString} from 'mdast-util-to-string'\nimport {asciiPunctuation} from 'micromark-util-character'\nimport {lintRule} from 'unified-lint-rule'\nimport {pointStart} from 'unist-util-position'\nimport {visitParents} from 'unist-util-visit-parents'\n\nconst defaultHttp = 'http://'\nconst defaultMailto = 'mailto:'\n\nconst remarkLintNoLiteralUrls = lintRule(\n {\n origin: 'remark-lint:no-literal-urls',\n url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-literal-urls#readme'\n },\n /**\n * @param {Root} tree\n * Tree.\n * @returns {undefined}\n * Nothing.\n */\n function (tree, file) {\n const value = String(file)\n\n visitParents(tree, 'link', function (node, parents) {\n const start = pointStart(node)\n\n if (!start || typeof start.offset !== 'number') return\n\n const raw = toString(node)\n\n /** @type {string | undefined} */\n let protocol\n let otherwiseFine = false\n\n if (raw === node.url) {\n otherwiseFine = true\n } else if (defaultHttp + raw === node.url) {\n protocol = defaultHttp\n } else if (defaultMailto + raw === node.url) {\n protocol = defaultMailto\n }\n\n if (\n // If the url is the same as the content…\n (protocol || otherwiseFine) &&\n // …and it doesn’t start with a marker.\n !asciiPunctuation(value.charCodeAt(start.offset))\n ) {\n file.message(\n 'Unexpected GFM autolink literal, expected regular autolink, add ' +\n (protocol ? '`<' + protocol + '`' : '`<`') +\n ' before and `>` after',\n {ancestors: [...parents, node], place: node.position}\n )\n }\n })\n }\n)\n\nexport default remarkLintNoLiteralUrls\n","/**\n * Throw a given error.\n *\n * @param {Error|null|undefined} [error]\n * Maybe error.\n * @returns {asserts error is null|undefined}\n */\nexport function bail(error) {\n if (error) {\n throw error\n }\n}\n","'use strict';\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n","export function deprecate(fn) {\n return fn\n}\n\nexport function equal() {}\n\nexport function ok() {}\n\nexport function unreachable() {}\n","export default function isPlainObject(value) {\n\tif (typeof value !== 'object' || value === null) {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Point} Point\n * @typedef {import('unist').Position} Position\n */\n\n/**\n * @typedef NodeLike\n * @property {string} type\n * @property {PositionLike | null | undefined} [position]\n *\n * @typedef PointLike\n * @property {number | null | undefined} [line]\n * @property {number | null | undefined} [column]\n * @property {number | null | undefined} [offset]\n *\n * @typedef PositionLike\n * @property {PointLike | null | undefined} [start]\n * @property {PointLike | null | undefined} [end]\n */\n\n/**\n * Serialize the positional info of a point, position (start and end points),\n * or node.\n *\n * @param {Node | NodeLike | Point | PointLike | Position | PositionLike | null | undefined} [value]\n * Node, position, or point.\n * @returns {string}\n * Pretty printed positional info of a node (`string`).\n *\n * In the format of a range `ls:cs-le:ce` (when given `node` or `position`)\n * or a point `l:c` (when given `point`), where `l` stands for line, `c` for\n * column, `s` for `start`, and `e` for end.\n * An empty string (`''`) is returned if the given value is neither `node`,\n * `position`, nor `point`.\n */\nexport function stringifyPosition(value) {\n // Nothing.\n if (!value || typeof value !== 'object') {\n return ''\n }\n\n // Node.\n if ('position' in value || 'type' in value) {\n return position(value.position)\n }\n\n // Position.\n if ('start' in value || 'end' in value) {\n return position(value)\n }\n\n // Point.\n if ('line' in value || 'column' in value) {\n return point(value)\n }\n\n // ?\n return ''\n}\n\n/**\n * @param {Point | PointLike | null | undefined} point\n * @returns {string}\n */\nfunction point(point) {\n return index(point && point.line) + ':' + index(point && point.column)\n}\n\n/**\n * @param {Position | PositionLike | null | undefined} pos\n * @returns {string}\n */\nfunction position(pos) {\n return point(pos && pos.start) + '-' + point(pos && pos.end)\n}\n\n/**\n * @param {number | null | undefined} value\n * @returns {number}\n */\nfunction index(value) {\n return value && typeof value === 'number' ? value : 1\n}\n","/**\n * @import {Node, Point, Position} from 'unist'\n */\n\n/**\n * @typedef {object & {type: string, position?: Position | undefined}} NodeLike\n *\n * @typedef Options\n * Configuration.\n * @property {Array<Node> | null | undefined} [ancestors]\n * Stack of (inclusive) ancestor nodes surrounding the message (optional).\n * @property {Error | null | undefined} [cause]\n * Original error cause of the message (optional).\n * @property {Point | Position | null | undefined} [place]\n * Place of message (optional).\n * @property {string | null | undefined} [ruleId]\n * Category of message (optional, example: `'my-rule'`).\n * @property {string | null | undefined} [source]\n * Namespace of who sent the message (optional, example: `'my-package'`).\n */\n\nimport {stringifyPosition} from 'unist-util-stringify-position'\n\n/**\n * Message.\n */\nexport class VFileMessage extends Error {\n /**\n * Create a message for `reason`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {Options | null | undefined} [options]\n * @returns\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns\n * Instance of `VFileMessage`.\n */\n // eslint-disable-next-line complexity\n constructor(causeOrReason, optionsOrParentOrPlace, origin) {\n super()\n\n if (typeof optionsOrParentOrPlace === 'string') {\n origin = optionsOrParentOrPlace\n optionsOrParentOrPlace = undefined\n }\n\n /** @type {string} */\n let reason = ''\n /** @type {Options} */\n let options = {}\n let legacyCause = false\n\n if (optionsOrParentOrPlace) {\n // Point.\n if (\n 'line' in optionsOrParentOrPlace &&\n 'column' in optionsOrParentOrPlace\n ) {\n options = {place: optionsOrParentOrPlace}\n }\n // Position.\n else if (\n 'start' in optionsOrParentOrPlace &&\n 'end' in optionsOrParentOrPlace\n ) {\n options = {place: optionsOrParentOrPlace}\n }\n // Node.\n else if ('type' in optionsOrParentOrPlace) {\n options = {\n ancestors: [optionsOrParentOrPlace],\n place: optionsOrParentOrPlace.position\n }\n }\n // Options.\n else {\n options = {...optionsOrParentOrPlace}\n }\n }\n\n if (typeof causeOrReason === 'string') {\n reason = causeOrReason\n }\n // Error.\n else if (!options.cause && causeOrReason) {\n legacyCause = true\n reason = causeOrReason.message\n options.cause = causeOrReason\n }\n\n if (!options.ruleId && !options.source && typeof origin === 'string') {\n const index = origin.indexOf(':')\n\n if (index === -1) {\n options.ruleId = origin\n } else {\n options.source = origin.slice(0, index)\n options.ruleId = origin.slice(index + 1)\n }\n }\n\n if (!options.place && options.ancestors && options.ancestors) {\n const parent = options.ancestors[options.ancestors.length - 1]\n\n if (parent) {\n options.place = parent.position\n }\n }\n\n const start =\n options.place && 'start' in options.place\n ? options.place.start\n : options.place\n\n /**\n * Stack of ancestor nodes surrounding the message.\n *\n * @type {Array<Node> | undefined}\n */\n this.ancestors = options.ancestors || undefined\n\n /**\n * Original error cause of the message.\n *\n * @type {Error | undefined}\n */\n this.cause = options.cause || undefined\n\n /**\n * Starting column of message.\n *\n * @type {number | undefined}\n */\n this.column = start ? start.column : undefined\n\n /**\n * State of problem.\n *\n * * `true` — error, file not usable\n * * `false` — warning, change may be needed\n * * `undefined` — change likely not needed\n *\n * @type {boolean | null | undefined}\n */\n this.fatal = undefined\n\n /**\n * Path of a file (used throughout the `VFile` ecosystem).\n *\n * @type {string | undefined}\n */\n this.file = ''\n\n // Field from `Error`.\n /**\n * Reason for message.\n *\n * @type {string}\n */\n this.message = reason\n\n /**\n * Starting line of error.\n *\n * @type {number | undefined}\n */\n this.line = start ? start.line : undefined\n\n // Field from `Error`.\n /**\n * Serialized positional info of message.\n *\n * On normal errors, this would be something like `ParseError`, buit in\n * `VFile` messages we use this space to show where an error happened.\n */\n this.name = stringifyPosition(options.place) || '1:1'\n\n /**\n * Place of message.\n *\n * @type {Point | Position | undefined}\n */\n this.place = options.place || undefined\n\n /**\n * Reason for message, should use markdown.\n *\n * @type {string}\n */\n this.reason = this.message\n\n /**\n * Category of message (example: `'my-rule'`).\n *\n * @type {string | undefined}\n */\n this.ruleId = options.ruleId || undefined\n\n /**\n * Namespace of message (example: `'my-package'`).\n *\n * @type {string | undefined}\n */\n this.source = options.source || undefined\n\n // Field from `Error`.\n /**\n * Stack of message.\n *\n * This is used by normal errors to show where something happened in\n * programming code, irrelevant for `VFile` messages,\n *\n * @type {string}\n */\n this.stack =\n legacyCause && options.cause && typeof options.cause.stack === 'string'\n ? options.cause.stack\n : ''\n\n // The following fields are “well known”.\n // Not standard.\n // Feel free to add other non-standard fields to your messages.\n\n /**\n * Specify the source value that’s being reported, which is deemed\n * incorrect.\n *\n * @type {string | undefined}\n */\n this.actual = undefined\n\n /**\n * Suggest acceptable values that can be used instead of `actual`.\n *\n * @type {Array<string> | undefined}\n */\n this.expected = undefined\n\n /**\n * Long form description of the message (you should use markdown).\n *\n * @type {string | undefined}\n */\n this.note = undefined\n\n /**\n * Link to docs for the message.\n *\n * > 👉 **Note**: this must be an absolute URL that can be passed as `x`\n * > to `new URL(x)`.\n *\n * @type {string | undefined}\n */\n this.url = undefined\n }\n}\n\nVFileMessage.prototype.file = ''\nVFileMessage.prototype.name = ''\nVFileMessage.prototype.reason = ''\nVFileMessage.prototype.message = ''\nVFileMessage.prototype.stack = ''\nVFileMessage.prototype.column = undefined\nVFileMessage.prototype.line = undefined\nVFileMessage.prototype.ancestors = undefined\nVFileMessage.prototype.cause = undefined\nVFileMessage.prototype.fatal = undefined\nVFileMessage.prototype.place = undefined\nVFileMessage.prototype.ruleId = undefined\nVFileMessage.prototype.source = undefined\n","/**\n * Checks if a value has the shape of a WHATWG URL object.\n *\n * Using a symbol or instanceof would not be able to recognize URL objects\n * coming from other implementations (e.g. in Electron), so instead we are\n * checking some well known properties for a lack of a better test.\n *\n * We use `href` and `protocol` as they are the only properties that are\n * easy to retrieve and calculate due to the lazy nature of the getters.\n *\n * We check for auth attribute to distinguish legacy url instance with\n * WHATWG URL instance.\n *\n * @param {unknown} fileUrlOrPath\n * File path or URL.\n * @returns {fileUrlOrPath is URL}\n * Whether it’s a URL.\n */\n// From: <https://github.com/nodejs/node/blob/6a3403c/lib/internal/url.js#L720>\nexport function isUrl(fileUrlOrPath) {\n return Boolean(\n fileUrlOrPath !== null &&\n typeof fileUrlOrPath === 'object' &&\n 'href' in fileUrlOrPath &&\n fileUrlOrPath.href &&\n 'protocol' in fileUrlOrPath &&\n fileUrlOrPath.protocol &&\n // @ts-expect-error: indexing is fine.\n fileUrlOrPath.auth === undefined\n )\n}\n","/**\n * @import {Node, Point, Position} from 'unist'\n * @import {Options as MessageOptions} from 'vfile-message'\n * @import {Compatible, Data, Map, Options, Value} from 'vfile'\n */\n\n/**\n * @typedef {object & {type: string, position?: Position | undefined}} NodeLike\n */\n\nimport {VFileMessage} from 'vfile-message'\nimport {minpath} from '#minpath'\nimport {minproc} from '#minproc'\nimport {urlToPath, isUrl} from '#minurl'\n\n/**\n * Order of setting (least specific to most), we need this because otherwise\n * `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a\n * stem can be set.\n */\nconst order = /** @type {const} */ ([\n 'history',\n 'path',\n 'basename',\n 'stem',\n 'extname',\n 'dirname'\n])\n\nexport class VFile {\n /**\n * Create a new virtual file.\n *\n * `options` is treated as:\n *\n * * `string` or `Uint8Array` — `{value: options}`\n * * `URL` — `{path: options}`\n * * `VFile` — shallow copies its data over to the new file\n * * `object` — all fields are shallow copied over to the new file\n *\n * Path related fields are set in the following order (least specific to\n * most specific): `history`, `path`, `basename`, `stem`, `extname`,\n * `dirname`.\n *\n * You cannot set `dirname` or `extname` without setting either `history`,\n * `path`, `basename`, or `stem` too.\n *\n * @param {Compatible | null | undefined} [value]\n * File value.\n * @returns\n * New instance.\n */\n constructor(value) {\n /** @type {Options | VFile} */\n let options\n\n if (!value) {\n options = {}\n } else if (isUrl(value)) {\n options = {path: value}\n } else if (typeof value === 'string' || isUint8Array(value)) {\n options = {value}\n } else {\n options = value\n }\n\n /* eslint-disable no-unused-expressions */\n\n /**\n * Base of `path` (default: `process.cwd()` or `'/'` in browsers).\n *\n * @type {string}\n */\n // Prevent calling `cwd` (which could be expensive) if it’s not needed;\n // the empty string will be overridden in the next block.\n this.cwd = 'cwd' in options ? '' : minproc.cwd()\n\n /**\n * Place to store custom info (default: `{}`).\n *\n * It’s OK to store custom data directly on the file but moving it to\n * `data` is recommended.\n *\n * @type {Data}\n */\n this.data = {}\n\n /**\n * List of file paths the file moved between.\n *\n * The first is the original path and the last is the current path.\n *\n * @type {Array<string>}\n */\n this.history = []\n\n /**\n * List of messages associated with the file.\n *\n * @type {Array<VFileMessage>}\n */\n this.messages = []\n\n /**\n * Raw value.\n *\n * @type {Value}\n */\n this.value\n\n // The below are non-standard, they are “well-known”.\n // As in, used in several tools.\n /**\n * Source map.\n *\n * This type is equivalent to the `RawSourceMap` type from the `source-map`\n * module.\n *\n * @type {Map | null | undefined}\n */\n this.map\n\n /**\n * Custom, non-string, compiled, representation.\n *\n * This is used by unified to store non-string results.\n * One example is when turning markdown into React nodes.\n *\n * @type {unknown}\n */\n this.result\n\n /**\n * Whether a file was saved to disk.\n *\n * This is used by vfile reporters.\n *\n * @type {boolean}\n */\n this.stored\n /* eslint-enable no-unused-expressions */\n\n // Set path related properties in the correct order.\n let index = -1\n\n while (++index < order.length) {\n const field = order[index]\n\n // Note: we specifically use `in` instead of `hasOwnProperty` to accept\n // `vfile`s too.\n if (\n field in options &&\n options[field] !== undefined &&\n options[field] !== null\n ) {\n // @ts-expect-error: TS doesn’t understand basic reality.\n this[field] = field === 'history' ? [...options[field]] : options[field]\n }\n }\n\n /** @type {string} */\n let field\n\n // Set non-path related properties.\n for (field in options) {\n // @ts-expect-error: fine to set other things.\n if (!order.includes(field)) {\n // @ts-expect-error: fine to set other things.\n this[field] = options[field]\n }\n }\n }\n\n /**\n * Get the basename (including extname) (example: `'index.min.js'`).\n *\n * @returns {string | undefined}\n * Basename.\n */\n get basename() {\n return typeof this.path === 'string'\n ? minpath.basename(this.path)\n : undefined\n }\n\n /**\n * Set basename (including extname) (`'index.min.js'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n *\n * @param {string} basename\n * Basename.\n * @returns {undefined}\n * Nothing.\n */\n set basename(basename) {\n assertNonEmpty(basename, 'basename')\n assertPart(basename, 'basename')\n this.path = minpath.join(this.dirname || '', basename)\n }\n\n /**\n * Get the parent path (example: `'~'`).\n *\n * @returns {string | undefined}\n * Dirname.\n */\n get dirname() {\n return typeof this.path === 'string'\n ? minpath.dirname(this.path)\n : undefined\n }\n\n /**\n * Set the parent path (example: `'~'`).\n *\n * Cannot be set if there’s no `path` yet.\n *\n * @param {string | undefined} dirname\n * Dirname.\n * @returns {undefined}\n * Nothing.\n */\n set dirname(dirname) {\n assertPath(this.basename, 'dirname')\n this.path = minpath.join(dirname || '', this.basename)\n }\n\n /**\n * Get the extname (including dot) (example: `'.js'`).\n *\n * @returns {string | undefined}\n * Extname.\n */\n get extname() {\n return typeof this.path === 'string'\n ? minpath.extname(this.path)\n : undefined\n }\n\n /**\n * Set the extname (including dot) (example: `'.js'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be set if there’s no `path` yet.\n *\n * @param {string | undefined} extname\n * Extname.\n * @returns {undefined}\n * Nothing.\n */\n set extname(extname) {\n assertPart(extname, 'extname')\n assertPath(this.dirname, 'extname')\n\n if (extname) {\n if (extname.codePointAt(0) !== 46 /* `.` */) {\n throw new Error('`extname` must start with `.`')\n }\n\n if (extname.includes('.', 1)) {\n throw new Error('`extname` cannot contain multiple dots')\n }\n }\n\n this.path = minpath.join(this.dirname, this.stem + (extname || ''))\n }\n\n /**\n * Get the full path (example: `'~/index.min.js'`).\n *\n * @returns {string}\n * Path.\n */\n get path() {\n return this.history[this.history.length - 1]\n }\n\n /**\n * Set the full path (example: `'~/index.min.js'`).\n *\n * Cannot be nullified.\n * You can set a file URL (a `URL` object with a `file:` protocol) which will\n * be turned into a path with `url.fileURLToPath`.\n *\n * @param {URL | string} path\n * Path.\n * @returns {undefined}\n * Nothing.\n */\n set path(path) {\n if (isUrl(path)) {\n path = urlToPath(path)\n }\n\n assertNonEmpty(path, 'path')\n\n if (this.path !== path) {\n this.history.push(path)\n }\n }\n\n /**\n * Get the stem (basename w/o extname) (example: `'index.min'`).\n *\n * @returns {string | undefined}\n * Stem.\n */\n get stem() {\n return typeof this.path === 'string'\n ? minpath.basename(this.path, this.extname)\n : undefined\n }\n\n /**\n * Set the stem (basename w/o extname) (example: `'index.min'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n *\n * @param {string} stem\n * Stem.\n * @returns {undefined}\n * Nothing.\n */\n set stem(stem) {\n assertNonEmpty(stem, 'stem')\n assertPart(stem, 'stem')\n this.path = minpath.join(this.dirname || '', stem + (this.extname || ''))\n }\n\n // Normal prototypal methods.\n /**\n * Create a fatal message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `true` (error; file not usable)\n * and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {never}\n * Never.\n * @throws {VFileMessage}\n * Message.\n */\n fail(causeOrReason, optionsOrParentOrPlace, origin) {\n // @ts-expect-error: the overloads are fine.\n const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n message.fatal = true\n\n throw message\n }\n\n /**\n * Create an info message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `undefined` (info; change\n * likely not needed) and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {VFileMessage}\n * Message.\n */\n info(causeOrReason, optionsOrParentOrPlace, origin) {\n // @ts-expect-error: the overloads are fine.\n const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n message.fatal = undefined\n\n return message\n }\n\n /**\n * Create a message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `false` (warning; change may be\n * needed) and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {VFileMessage}\n * Message.\n */\n message(causeOrReason, optionsOrParentOrPlace, origin) {\n const message = new VFileMessage(\n // @ts-expect-error: the overloads are fine.\n causeOrReason,\n optionsOrParentOrPlace,\n origin\n )\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n }\n\n /**\n * Serialize the file.\n *\n * > **Note**: which encodings are supported depends on the engine.\n * > For info on Node.js, see:\n * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>.\n *\n * @param {string | null | undefined} [encoding='utf8']\n * Character encoding to understand `value` as when it’s a `Uint8Array`\n * (default: `'utf-8'`).\n * @returns {string}\n * Serialized file.\n */\n toString(encoding) {\n if (this.value === undefined) {\n return ''\n }\n\n if (typeof this.value === 'string') {\n return this.value\n }\n\n const decoder = new TextDecoder(encoding || undefined)\n return decoder.decode(this.value)\n }\n}\n\n/**\n * Assert that `part` is not a path (as in, does not contain `path.sep`).\n *\n * @param {string | null | undefined} part\n * File path part.\n * @param {string} name\n * Part name.\n * @returns {undefined}\n * Nothing.\n */\nfunction assertPart(part, name) {\n if (part && part.includes(minpath.sep)) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + minpath.sep + '`'\n )\n }\n}\n\n/**\n * Assert that `part` is not empty.\n *\n * @param {string | undefined} part\n * Thing.\n * @param {string} name\n * Part name.\n * @returns {asserts part is string}\n * Nothing.\n */\nfunction assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}\n\n/**\n * Assert `path` exists.\n *\n * @param {string | undefined} path\n * Path.\n * @param {string} name\n * Dependency name.\n * @returns {asserts path is string}\n * Nothing.\n */\nfunction assertPath(path, name) {\n if (!path) {\n throw new Error('Setting `' + name + '` requires `path` to be set too')\n }\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n * thing.\n * @returns {value is Uint8Array}\n * Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'byteLength' in value &&\n 'byteOffset' in value\n )\n}\n","export const CallableInstance =\n /**\n * @type {new <Parameters extends Array<unknown>, Result>(property: string | symbol) => (...parameters: Parameters) => Result}\n */\n (\n /** @type {unknown} */\n (\n /**\n * @this {Function}\n * @param {string | symbol} property\n * @returns {(...parameters: Array<unknown>) => unknown}\n */\n function (property) {\n const self = this\n const constr = self.constructor\n const proto = /** @type {Record<string | symbol, Function>} */ (\n // Prototypes do exist.\n // type-coverage:ignore-next-line\n constr.prototype\n )\n const value = proto[property]\n /** @type {(...parameters: Array<unknown>) => unknown} */\n const apply = function () {\n return value.apply(apply, arguments)\n }\n\n Object.setPrototypeOf(apply, proto)\n\n // Not needed for us in `unified`: we only call this on the `copy`\n // function,\n // and we don't need to add its fields (`length`, `name`)\n // over.\n // See also: GH-246.\n // const names = Object.getOwnPropertyNames(value)\n //\n // for (const p of names) {\n // const descriptor = Object.getOwnPropertyDescriptor(value, p)\n // if (descriptor) Object.defineProperty(apply, p, descriptor)\n // }\n\n return apply\n }\n )\n )\n","/**\n * @typedef {import('trough').Pipeline} Pipeline\n *\n * @typedef {import('unist').Node} Node\n *\n * @typedef {import('vfile').Compatible} Compatible\n * @typedef {import('vfile').Value} Value\n *\n * @typedef {import('../index.js').CompileResultMap} CompileResultMap\n * @typedef {import('../index.js').Data} Data\n * @typedef {import('../index.js').Settings} Settings\n */\n\n/**\n * @typedef {CompileResultMap[keyof CompileResultMap]} CompileResults\n * Acceptable results from compilers.\n *\n * To register custom results, add them to\n * {@linkcode CompileResultMap}.\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The node that the compiler receives (default: `Node`).\n * @template {CompileResults} [Result=CompileResults]\n * The thing that the compiler yields (default: `CompileResults`).\n * @callback Compiler\n * A **compiler** handles the compiling of a syntax tree to something else\n * (in most cases, text) (TypeScript type).\n *\n * It is used in the stringify phase and called with a {@linkcode Node}\n * and {@linkcode VFile} representation of the document to compile.\n * It should return the textual representation of the given tree (typically\n * `string`).\n *\n * > **Note**: unified typically compiles by serializing: most compilers\n * > return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n * @param {Tree} tree\n * Tree to compile.\n * @param {VFile} file\n * File associated with `tree`.\n * @returns {Result}\n * New content: compiled text (`string` or `Uint8Array`, for `file.value`) or\n * something else (for `file.result`).\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The node that the parser yields (default: `Node`)\n * @callback Parser\n * A **parser** handles the parsing of text to a syntax tree.\n *\n * It is used in the parse phase and is called with a `string` and\n * {@linkcode VFile} of the document to parse.\n * It must return the syntax tree representation of the given file\n * ({@linkcode Node}).\n * @param {string} document\n * Document to parse.\n * @param {VFile} file\n * File associated with `document`.\n * @returns {Tree}\n * Node representing the given file.\n */\n\n/**\n * @typedef {(\n * Plugin<Array<any>, any, any> |\n * PluginTuple<Array<any>, any, any> |\n * Preset\n * )} Pluggable\n * Union of the different ways to add plugins and settings.\n */\n\n/**\n * @typedef {Array<Pluggable>} PluggableList\n * List of plugins and presets.\n */\n\n// Note: we can’t use `callback` yet as it messes up `this`:\n// <https://github.com/microsoft/TypeScript/issues/55197>.\n/**\n * @template {Array<unknown>} [PluginParameters=[]]\n * Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=Node]\n * Value that is expected as input (default: `Node`).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node it expects.\n * * If the plugin sets a {@linkcode Parser}, this should be\n * `string`.\n * * If the plugin sets a {@linkcode Compiler}, this should be the\n * node it expects.\n * @template [Output=Input]\n * Value that is yielded as output (default: `Input`).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node that that yields.\n * * If the plugin sets a {@linkcode Parser}, this should be the\n * node that it yields.\n * * If the plugin sets a {@linkcode Compiler}, this should be\n * result it yields.\n * @typedef {(\n * (this: Processor, ...parameters: PluginParameters) =>\n * Input extends string ? // Parser.\n * Output extends Node | undefined ? undefined | void : never :\n * Output extends CompileResults ? // Compiler.\n * Input extends Node | undefined ? undefined | void : never :\n * Transformer<\n * Input extends Node ? Input : Node,\n * Output extends Node ? Output : Node\n * > | undefined | void\n * )} Plugin\n * Single plugin.\n *\n * Plugins configure the processors they are applied on in the following\n * ways:\n *\n * * they change the processor, such as the parser, the compiler, or by\n * configuring data\n * * they specify how to handle trees and files\n *\n * In practice, they are functions that can receive options and configure the\n * processor (`this`).\n *\n * > **Note**: plugins are called when the processor is *frozen*, not when\n * > they are applied.\n */\n\n/**\n * Tuple of a plugin and its configuration.\n *\n * The first item is a plugin, the rest are its parameters.\n *\n * @template {Array<unknown>} [TupleParameters=[]]\n * Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=undefined]\n * Value that is expected as input (optional).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node it expects.\n * * If the plugin sets a {@linkcode Parser}, this should be\n * `string`.\n * * If the plugin sets a {@linkcode Compiler}, this should be the\n * node it expects.\n * @template [Output=undefined] (optional).\n * Value that is yielded as output.\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node that that yields.\n * * If the plugin sets a {@linkcode Parser}, this should be the\n * node that it yields.\n * * If the plugin sets a {@linkcode Compiler}, this should be\n * result it yields.\n * @typedef {(\n * [\n * plugin: Plugin<TupleParameters, Input, Output>,\n * ...parameters: TupleParameters\n * ]\n * )} PluginTuple\n */\n\n/**\n * @typedef Preset\n * Sharable configuration.\n *\n * They can contain plugins and settings.\n * @property {PluggableList | undefined} [plugins]\n * List of plugins and presets (optional).\n * @property {Settings | undefined} [settings]\n * Shared settings for parsers and compilers (optional).\n */\n\n/**\n * @template {VFile} [File=VFile]\n * The file that the callback receives (default: `VFile`).\n * @callback ProcessCallback\n * Callback called when the process is done.\n *\n * Called with either an error or a result.\n * @param {Error | undefined} [error]\n * Fatal error (optional).\n * @param {File | undefined} [file]\n * Processed file (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The tree that the callback receives (default: `Node`).\n * @callback RunCallback\n * Callback called when transformers are done.\n *\n * Called with either an error or results.\n * @param {Error | undefined} [error]\n * Fatal error (optional).\n * @param {Tree | undefined} [tree]\n * Transformed tree (optional).\n * @param {VFile | undefined} [file]\n * File (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Output=Node]\n * Node type that the transformer yields (default: `Node`).\n * @callback TransformCallback\n * Callback passed to transforms.\n *\n * If the signature of a `transformer` accepts a third argument, the\n * transformer may perform asynchronous operations, and must call it.\n * @param {Error | undefined} [error]\n * Fatal error to stop the process (optional).\n * @param {Output | undefined} [tree]\n * New, changed, tree (optional).\n * @param {VFile | undefined} [file]\n * New, changed, file (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Input=Node]\n * Node type that the transformer expects (default: `Node`).\n * @template {Node} [Output=Input]\n * Node type that the transformer yields (default: `Input`).\n * @callback Transformer\n * Transformers handle syntax trees and files.\n *\n * They are functions that are called each time a syntax tree and file are\n * passed through the run phase.\n * When an error occurs in them (either because it’s thrown, returned,\n * rejected, or passed to `next`), the process stops.\n *\n * The run phase is handled by [`trough`][trough], see its documentation for\n * the exact semantics of these functions.\n *\n * > **Note**: you should likely ignore `next`: don’t accept it.\n * > it supports callback-style async work.\n * > But promises are likely easier to reason about.\n *\n * [trough]: https://github.com/wooorm/trough#function-fninput-next\n * @param {Input} tree\n * Tree to handle.\n * @param {VFile} file\n * File to handle.\n * @param {TransformCallback<Output>} next\n * Callback.\n * @returns {(\n * Promise<Output | undefined | void> |\n * Promise<never> | // For some reason this is needed separately.\n * Output |\n * Error |\n * undefined |\n * void\n * )}\n * If you accept `next`, nothing.\n * Otherwise:\n *\n * * `Error` — fatal error to stop the process\n * * `Promise<undefined>` or `undefined` — the next transformer keeps using\n * same tree\n * * `Promise<Node>` or `Node` — new, changed, tree\n */\n\n/**\n * @template {Node | undefined} ParseTree\n * Output of `parse`.\n * @template {Node | undefined} HeadTree\n * Input for `run`.\n * @template {Node | undefined} TailTree\n * Output for `run`.\n * @template {Node | undefined} CompileTree\n * Input of `stringify`.\n * @template {CompileResults | undefined} CompileResult\n * Output of `stringify`.\n * @template {Node | string | undefined} Input\n * Input of plugin.\n * @template Output\n * Output of plugin (optional).\n * @typedef {(\n * Input extends string\n * ? Output extends Node | undefined\n * ? // Parser.\n * Processor<\n * Output extends undefined ? ParseTree : Output,\n * HeadTree,\n * TailTree,\n * CompileTree,\n * CompileResult\n * >\n * : // Unknown.\n * Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>\n * : Output extends CompileResults\n * ? Input extends Node | undefined\n * ? // Compiler.\n * Processor<\n * ParseTree,\n * HeadTree,\n * TailTree,\n * Input extends undefined ? CompileTree : Input,\n * Output extends undefined ? CompileResult : Output\n * >\n * : // Unknown.\n * Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>\n * : Input extends Node | undefined\n * ? Output extends Node | undefined\n * ? // Transform.\n * Processor<\n * ParseTree,\n * HeadTree extends undefined ? Input : HeadTree,\n * Output extends undefined ? TailTree : Output,\n * CompileTree,\n * CompileResult\n * >\n * : // Unknown.\n * Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>\n * : // Unknown.\n * Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>\n * )} UsePlugin\n * Create a processor based on the input/output of a {@link Plugin plugin}.\n */\n\n/**\n * @template {CompileResults | undefined} Result\n * Node type that the transformer yields.\n * @typedef {(\n * Result extends Value | undefined ?\n * VFile :\n * VFile & {result: Result}\n * )} VFileWithOutput\n * Type to generate a {@linkcode VFile} corresponding to a compiler result.\n *\n * If a result that is not acceptable on a `VFile` is used, that will\n * be stored on the `result` field of {@linkcode VFile}.\n */\n\nimport {bail} from 'bail'\nimport extend from 'extend'\nimport {ok as assert} from 'devlop'\nimport isPlainObj from 'is-plain-obj'\nimport {trough} from 'trough'\nimport {VFile} from 'vfile'\nimport {CallableInstance} from './callable-instance.js'\n\n// To do: next major: drop `Compiler`, `Parser`: prefer lowercase.\n\n// To do: we could start yielding `never` in TS when a parser is missing and\n// `parse` is called.\n// Currently, we allow directly setting `processor.parser`, which is untyped.\n\nconst own = {}.hasOwnProperty\n\n/**\n * @template {Node | undefined} [ParseTree=undefined]\n * Output of `parse` (optional).\n * @template {Node | undefined} [HeadTree=undefined]\n * Input for `run` (optional).\n * @template {Node | undefined} [TailTree=undefined]\n * Output for `run` (optional).\n * @template {Node | undefined} [CompileTree=undefined]\n * Input of `stringify` (optional).\n * @template {CompileResults | undefined} [CompileResult=undefined]\n * Output of `stringify` (optional).\n * @extends {CallableInstance<[], Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>>}\n */\nexport class Processor extends CallableInstance {\n /**\n * Create a processor.\n */\n constructor() {\n // If `Processor()` is called (w/o new), `copy` is called instead.\n super('copy')\n\n /**\n * Compiler to use (deprecated).\n *\n * @deprecated\n * Use `compiler` instead.\n * @type {(\n * Compiler<\n * CompileTree extends undefined ? Node : CompileTree,\n * CompileResult extends undefined ? CompileResults : CompileResult\n * > |\n * undefined\n * )}\n */\n this.Compiler = undefined\n\n /**\n * Parser to use (deprecated).\n *\n * @deprecated\n * Use `parser` instead.\n * @type {(\n * Parser<ParseTree extends undefined ? Node : ParseTree> |\n * undefined\n * )}\n */\n this.Parser = undefined\n\n // Note: the following fields are considered private.\n // However, they are needed for tests, and TSC generates an untyped\n // `private freezeIndex` field for, which trips `type-coverage` up.\n // Instead, we use `@deprecated` to visualize that they shouldn’t be used.\n /**\n * Internal list of configured plugins.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Array<PluginTuple<Array<unknown>>>}\n */\n this.attachers = []\n\n /**\n * Compiler to use.\n *\n * @type {(\n * Compiler<\n * CompileTree extends undefined ? Node : CompileTree,\n * CompileResult extends undefined ? CompileResults : CompileResult\n * > |\n * undefined\n * )}\n */\n this.compiler = undefined\n\n /**\n * Internal state to track where we are while freezing.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {number}\n */\n this.freezeIndex = -1\n\n /**\n * Internal state to track whether we’re frozen.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {boolean | undefined}\n */\n this.frozen = undefined\n\n /**\n * Internal state.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Data}\n */\n this.namespace = {}\n\n /**\n * Parser to use.\n *\n * @type {(\n * Parser<ParseTree extends undefined ? Node : ParseTree> |\n * undefined\n * )}\n */\n this.parser = undefined\n\n /**\n * Internal list of configured transformers.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Pipeline}\n */\n this.transformers = trough()\n }\n\n /**\n * Copy a processor.\n *\n * @deprecated\n * This is a private internal method and should not be used.\n * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n * New *unfrozen* processor ({@linkcode Processor}) that is\n * configured to work the same as its ancestor.\n * When the descendant processor is configured in the future it does not\n * affect the ancestral processor.\n */\n copy() {\n // Cast as the type parameters will be the same after attaching.\n const destination =\n /** @type {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>} */ (\n new Processor()\n )\n let index = -1\n\n while (++index < this.attachers.length) {\n const attacher = this.attachers[index]\n destination.use(...attacher)\n }\n\n destination.data(extend(true, {}, this.namespace))\n\n return destination\n }\n\n /**\n * Configure the processor with info available to all plugins.\n * Information is stored in an object.\n *\n * Typically, options can be given to a specific plugin, but sometimes it\n * makes sense to have information shared with several plugins.\n * For example, a list of HTML elements that are self-closing, which is\n * needed during all phases.\n *\n * > **Note**: setting information cannot occur on *frozen* processors.\n * > Call the processor first to create a new unfrozen processor.\n *\n * > **Note**: to register custom data in TypeScript, augment the\n * > {@linkcode Data} interface.\n *\n * @example\n * This example show how to get and set info:\n *\n * ```js\n * import {unified} from 'unified'\n *\n * const processor = unified().data('alpha', 'bravo')\n *\n * processor.data('alpha') // => 'bravo'\n *\n * processor.data() // => {alpha: 'bravo'}\n *\n * processor.data({charlie: 'delta'})\n *\n * processor.data() // => {charlie: 'delta'}\n * ```\n *\n * @template {keyof Data} Key\n *\n * @overload\n * @returns {Data}\n *\n * @overload\n * @param {Data} dataset\n * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n *\n * @overload\n * @param {Key} key\n * @returns {Data[Key]}\n *\n * @overload\n * @param {Key} key\n * @param {Data[Key]} value\n * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n *\n * @param {Data | Key} [key]\n * Key to get or set, or entire dataset to set, or nothing to get the\n * entire dataset (optional).\n * @param {Data[Key]} [value]\n * Value to set (optional).\n * @returns {unknown}\n * The current processor when setting, the value at `key` when getting, or\n * the entire dataset when getting without key.\n */\n data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', this.frozen)\n this.namespace[key] = value\n return this\n }\n\n // Get `key`.\n return (own.call(this.namespace, key) && this.namespace[key]) || undefined\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', this.frozen)\n this.namespace = key\n return this\n }\n\n // Get space.\n return this.namespace\n }\n\n /**\n * Freeze a processor.\n *\n * Frozen processors are meant to be extended and not to be configured\n * directly.\n *\n * When a processor is frozen it cannot be unfrozen.\n * New processors working the same way can be created by calling the\n * processor.\n *\n * It’s possible to freeze processors explicitly by calling `.freeze()`.\n * Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,\n * `.stringify()`, `.process()`, or `.processSync()` are called.\n *\n * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n * The current processor.\n */\n freeze() {\n if (this.frozen) {\n return this\n }\n\n // Cast so that we can type plugins easier.\n // Plugins are supposed to be usable on different processors, not just on\n // this exact processor.\n const self = /** @type {Processor} */ (/** @type {unknown} */ (this))\n\n while (++this.freezeIndex < this.attachers.length) {\n const [attacher, ...options] = this.attachers[this.freezeIndex]\n\n if (options[0] === false) {\n continue\n }\n\n if (options[0] === true) {\n options[0] = undefined\n }\n\n const transformer = attacher.call(self, ...options)\n\n if (typeof transformer === 'function') {\n this.transformers.use(transformer)\n }\n }\n\n this.frozen = true\n this.freezeIndex = Number.POSITIVE_INFINITY\n\n return this\n }\n\n /**\n * Parse text to a syntax tree.\n *\n * > **Note**: `parse` freezes the processor if not already *frozen*.\n *\n * > **Note**: `parse` performs the parse phase, not the run phase or other\n * > phases.\n *\n * @param {Compatible | undefined} [file]\n * file to parse (optional); typically `string` or `VFile`; any value\n * accepted as `x` in `new VFile(x)`.\n * @returns {ParseTree extends undefined ? Node : ParseTree}\n * Syntax tree representing `file`.\n */\n parse(file) {\n this.freeze()\n const realFile = vfile(file)\n const parser = this.parser || this.Parser\n assertParser('parse', parser)\n return parser(String(realFile), realFile)\n }\n\n /**\n * Process the given file as configured on the processor.\n *\n * > **Note**: `process` freezes the processor if not already *frozen*.\n *\n * > **Note**: `process` performs the parse, run, and stringify phases.\n *\n * @overload\n * @param {Compatible | undefined} file\n * @param {ProcessCallback<VFileWithOutput<CompileResult>>} done\n * @returns {undefined}\n *\n * @overload\n * @param {Compatible | undefined} [file]\n * @returns {Promise<VFileWithOutput<CompileResult>>}\n *\n * @param {Compatible | undefined} [file]\n * File (optional); typically `string` or `VFile`]; any value accepted as\n * `x` in `new VFile(x)`.\n * @param {ProcessCallback<VFileWithOutput<CompileResult>> | undefined} [done]\n * Callback (optional).\n * @returns {Promise<VFile> | undefined}\n * Nothing if `done` is given.\n * Otherwise a promise, rejected with a fatal error or resolved with the\n * processed file.\n *\n * The parsed, transformed, and compiled value is available at\n * `file.value` (see note).\n *\n * > **Note**: unified typically compiles by serializing: most\n * > compilers return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n process(file, done) {\n const self = this\n\n this.freeze()\n assertParser('process', this.parser || this.Parser)\n assertCompiler('process', this.compiler || this.Compiler)\n\n return done ? executor(undefined, done) : new Promise(executor)\n\n // Note: `void`s needed for TS.\n /**\n * @param {((file: VFileWithOutput<CompileResult>) => undefined | void) | undefined} resolve\n * @param {(error: Error | undefined) => undefined | void} reject\n * @returns {undefined}\n */\n function executor(resolve, reject) {\n const realFile = vfile(file)\n // Assume `ParseTree` (the result of the parser) matches `HeadTree` (the\n // input of the first transform).\n const parseTree =\n /** @type {HeadTree extends undefined ? Node : HeadTree} */ (\n /** @type {unknown} */ (self.parse(realFile))\n )\n\n self.run(parseTree, realFile, function (error, tree, file) {\n if (error || !tree || !file) {\n return realDone(error)\n }\n\n // Assume `TailTree` (the output of the last transform) matches\n // `CompileTree` (the input of the compiler).\n const compileTree =\n /** @type {CompileTree extends undefined ? Node : CompileTree} */ (\n /** @type {unknown} */ (tree)\n )\n\n const compileResult = self.stringify(compileTree, file)\n\n if (looksLikeAValue(compileResult)) {\n file.value = compileResult\n } else {\n file.result = compileResult\n }\n\n realDone(error, /** @type {VFileWithOutput<CompileResult>} */ (file))\n })\n\n /**\n * @param {Error | undefined} error\n * @param {VFileWithOutput<CompileResult> | undefined} [file]\n * @returns {undefined}\n */\n function realDone(error, file) {\n if (error || !file) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n assert(done, '`done` is defined if `resolve` is not')\n done(undefined, file)\n }\n }\n }\n }\n\n /**\n * Process the given file as configured on the processor.\n *\n * An error is thrown if asynchronous transforms are configured.\n *\n * > **Note**: `processSync` freezes the processor if not already *frozen*.\n *\n * > **Note**: `processSync` performs the parse, run, and stringify phases.\n *\n * @param {Compatible | undefined} [file]\n * File (optional); typically `string` or `VFile`; any value accepted as\n * `x` in `new VFile(x)`.\n * @returns {VFileWithOutput<CompileResult>}\n * The processed file.\n *\n * The parsed, transformed, and compiled value is available at\n * `file.value` (see note).\n *\n * > **Note**: unified typically compiles by serializing: most\n * > compilers return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n processSync(file) {\n /** @type {boolean} */\n let complete = false\n /** @type {VFileWithOutput<CompileResult> | undefined} */\n let result\n\n this.freeze()\n assertParser('processSync', this.parser || this.Parser)\n assertCompiler('processSync', this.compiler || this.Compiler)\n\n this.process(file, realDone)\n assertDone('processSync', 'process', complete)\n assert(result, 'we either bailed on an error or have a tree')\n\n return result\n\n /**\n * @type {ProcessCallback<VFileWithOutput<CompileResult>>}\n */\n function realDone(error, file) {\n complete = true\n bail(error)\n result = file\n }\n }\n\n /**\n * Run *transformers* on a syntax tree.\n *\n * > **Note**: `run` freezes the processor if not already *frozen*.\n *\n * > **Note**: `run` performs the run phase, not other phases.\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done\n * @returns {undefined}\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {Compatible | undefined} file\n * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done\n * @returns {undefined}\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {Compatible | undefined} [file]\n * @returns {Promise<TailTree extends undefined ? Node : TailTree>}\n *\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * Tree to transform and inspect.\n * @param {(\n * RunCallback<TailTree extends undefined ? Node : TailTree> |\n * Compatible\n * )} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} [done]\n * Callback (optional).\n * @returns {Promise<TailTree extends undefined ? Node : TailTree> | undefined}\n * Nothing if `done` is given.\n * Otherwise, a promise rejected with a fatal error or resolved with the\n * transformed tree.\n */\n run(tree, file, done) {\n assertNode(tree)\n this.freeze()\n\n const transformers = this.transformers\n\n if (!done && typeof file === 'function') {\n done = file\n file = undefined\n }\n\n return done ? executor(undefined, done) : new Promise(executor)\n\n // Note: `void`s needed for TS.\n /**\n * @param {(\n * ((tree: TailTree extends undefined ? Node : TailTree) => undefined | void) |\n * undefined\n * )} resolve\n * @param {(error: Error) => undefined | void} reject\n * @returns {undefined}\n */\n function executor(resolve, reject) {\n assert(\n typeof file !== 'function',\n '`file` can’t be a `done` anymore, we checked'\n )\n const realFile = vfile(file)\n transformers.run(tree, realFile, realDone)\n\n /**\n * @param {Error | undefined} error\n * @param {Node} outputTree\n * @param {VFile} file\n * @returns {undefined}\n */\n function realDone(error, outputTree, file) {\n const resultingTree =\n /** @type {TailTree extends undefined ? Node : TailTree} */ (\n outputTree || tree\n )\n\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(resultingTree)\n } else {\n assert(done, '`done` is defined if `resolve` is not')\n done(undefined, resultingTree, file)\n }\n }\n }\n }\n\n /**\n * Run *transformers* on a syntax tree.\n *\n * An error is thrown if asynchronous transforms are configured.\n *\n * > **Note**: `runSync` freezes the processor if not already *frozen*.\n *\n * > **Note**: `runSync` performs the run phase, not other phases.\n *\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * Tree to transform and inspect.\n * @param {Compatible | undefined} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @returns {TailTree extends undefined ? Node : TailTree}\n * Transformed tree.\n */\n runSync(tree, file) {\n /** @type {boolean} */\n let complete = false\n /** @type {(TailTree extends undefined ? Node : TailTree) | undefined} */\n let result\n\n this.run(tree, file, realDone)\n\n assertDone('runSync', 'run', complete)\n assert(result, 'we either bailed on an error or have a tree')\n return result\n\n /**\n * @type {RunCallback<TailTree extends undefined ? Node : TailTree>}\n */\n function realDone(error, tree) {\n bail(error)\n result = tree\n complete = true\n }\n }\n\n /**\n * Compile a syntax tree.\n *\n * > **Note**: `stringify` freezes the processor if not already *frozen*.\n *\n * > **Note**: `stringify` performs the stringify phase, not the run phase\n * > or other phases.\n *\n * @param {CompileTree extends undefined ? Node : CompileTree} tree\n * Tree to compile.\n * @param {Compatible | undefined} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @returns {CompileResult extends undefined ? Value : CompileResult}\n * Textual representation of the tree (see note).\n *\n * > **Note**: unified typically compiles by serializing: most compilers\n * > return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n stringify(tree, file) {\n this.freeze()\n const realFile = vfile(file)\n const compiler = this.compiler || this.Compiler\n assertCompiler('stringify', compiler)\n assertNode(tree)\n\n return compiler(tree, realFile)\n }\n\n /**\n * Configure the processor to use a plugin, a list of usable values, or a\n * preset.\n *\n * If the processor is already using a plugin, the previous plugin\n * configuration is changed based on the options that are passed in.\n * In other words, the plugin is not added a second time.\n *\n * > **Note**: `use` cannot be called on *frozen* processors.\n * > Call the processor first to create a new unfrozen processor.\n *\n * @example\n * There are many ways to pass plugins to `.use()`.\n * This example gives an overview:\n *\n * ```js\n * import {unified} from 'unified'\n *\n * unified()\n * // Plugin with options:\n * .use(pluginA, {x: true, y: true})\n * // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):\n * .use(pluginA, {y: false, z: true})\n * // Plugins:\n * .use([pluginB, pluginC])\n * // Two plugins, the second with options:\n * .use([pluginD, [pluginE, {}]])\n * // Preset with plugins and settings:\n * .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})\n * // Settings only:\n * .use({settings: {position: false}})\n * ```\n *\n * @template {Array<unknown>} [Parameters=[]]\n * @template {Node | string | undefined} [Input=undefined]\n * @template [Output=Input]\n *\n * @overload\n * @param {Preset | null | undefined} [preset]\n * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n *\n * @overload\n * @param {PluggableList} list\n * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n *\n * @overload\n * @param {Plugin<Parameters, Input, Output>} plugin\n * @param {...(Parameters | [boolean])} parameters\n * @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}\n *\n * @param {PluggableList | Plugin | Preset | null | undefined} value\n * Usable value.\n * @param {...unknown} parameters\n * Parameters, when a plugin is given as a usable value.\n * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n * Current processor.\n */\n use(value, ...parameters) {\n const attachers = this.attachers\n const namespace = this.namespace\n\n assertUnfrozen('use', this.frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin(value, parameters)\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n\n return this\n\n /**\n * @param {Pluggable} value\n * @returns {undefined}\n */\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value, [])\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n const [plugin, ...parameters] =\n /** @type {PluginTuple<Array<unknown>>} */ (value)\n addPlugin(plugin, parameters)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n }\n\n /**\n * @param {Preset} result\n * @returns {undefined}\n */\n function addPreset(result) {\n if (!('plugins' in result) && !('settings' in result)) {\n throw new Error(\n 'Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither'\n )\n }\n\n addList(result.plugins)\n\n if (result.settings) {\n namespace.settings = extend(true, namespace.settings, result.settings)\n }\n }\n\n /**\n * @param {PluggableList | null | undefined} plugins\n * @returns {undefined}\n */\n function addList(plugins) {\n let index = -1\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (Array.isArray(plugins)) {\n while (++index < plugins.length) {\n const thing = plugins[index]\n add(thing)\n }\n } else {\n throw new TypeError('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n /**\n * @param {Plugin} plugin\n * @param {Array<unknown>} parameters\n * @returns {undefined}\n */\n function addPlugin(plugin, parameters) {\n let index = -1\n let entryIndex = -1\n\n while (++index < attachers.length) {\n if (attachers[index][0] === plugin) {\n entryIndex = index\n break\n }\n }\n\n if (entryIndex === -1) {\n attachers.push([plugin, ...parameters])\n }\n // Only set if there was at least a `primary` value, otherwise we’d change\n // `arguments.length`.\n else if (parameters.length > 0) {\n let [primary, ...rest] = parameters\n const currentPrimary = attachers[entryIndex][1]\n if (isPlainObj(currentPrimary) && isPlainObj(primary)) {\n primary = extend(true, currentPrimary, primary)\n }\n\n attachers[entryIndex] = [plugin, primary, ...rest]\n }\n }\n }\n}\n\n// Note: this returns a *callable* instance.\n// That’s why it’s documented as a function.\n/**\n * Create a new processor.\n *\n * @example\n * This example shows how a new processor can be created (from `remark`) and linked\n * to **stdin**(4) and **stdout**(4).\n *\n * ```js\n * import process from 'node:process'\n * import concatStream from 'concat-stream'\n * import {remark} from 'remark'\n *\n * process.stdin.pipe(\n * concatStream(function (buf) {\n * process.stdout.write(String(remark().processSync(buf)))\n * })\n * )\n * ```\n *\n * @returns\n * New *unfrozen* processor (`processor`).\n *\n * This processor is configured to work the same as its ancestor.\n * When the descendant processor is configured in the future it does not\n * affect the ancestral processor.\n */\nexport const unified = new Processor().freeze()\n\n/**\n * Assert a parser is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Parser}\n */\nfunction assertParser(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `parser`')\n }\n}\n\n/**\n * Assert a compiler is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Compiler}\n */\nfunction assertCompiler(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `compiler`')\n }\n}\n\n/**\n * Assert the processor is not frozen.\n *\n * @param {string} name\n * @param {unknown} frozen\n * @returns {asserts frozen is false}\n */\nfunction assertUnfrozen(name, frozen) {\n if (frozen) {\n throw new Error(\n 'Cannot call `' +\n name +\n '` on a frozen processor.\\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'\n )\n }\n}\n\n/**\n * Assert `node` is a unist node.\n *\n * @param {unknown} node\n * @returns {asserts node is Node}\n */\nfunction assertNode(node) {\n // `isPlainObj` unfortunately uses `any` instead of `unknown`.\n // type-coverage:ignore-next-line\n if (!isPlainObj(node) || typeof node.type !== 'string') {\n throw new TypeError('Expected node, got `' + node + '`')\n // Fine.\n }\n}\n\n/**\n * Assert that `complete` is `true`.\n *\n * @param {string} name\n * @param {string} asyncName\n * @param {unknown} complete\n * @returns {asserts complete is true}\n */\nfunction assertDone(name, asyncName, complete) {\n if (!complete) {\n throw new Error(\n '`' + name + '` finished async. Use `' + asyncName + '` instead'\n )\n }\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {VFile}\n */\nfunction vfile(value) {\n return looksLikeAVFile(value) ? value : new VFile(value)\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {value is VFile}\n */\nfunction looksLikeAVFile(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'message' in value &&\n 'messages' in value\n )\n}\n\n/**\n * @param {unknown} [value]\n * @returns {value is Value}\n */\nfunction looksLikeAValue(value) {\n return typeof value === 'string' || isUint8Array(value)\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n * thing.\n * @returns {value is Uint8Array}\n * Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'byteLength' in value &&\n 'byteOffset' in value\n )\n}\n","/**\n * Adapter: run a remark-lint rule against the Sätteri mdast tree, return\n * `RuleReport[]`. Mirrors the `zod-adapter` shape — a tiny translation\n * layer that keeps the diagnostic envelope intact while letting us inherit\n * remark-lint's battle-tested detector logic.\n *\n * Why this is safe under the Sätteri constraint: the \"remark plugins\n * no-op\" line in CLAUDE.md describes render-time transforms attached to\n * `markdown.processor`. Lint rules are read-only `(tree, file) => void`\n * functions that walk an mdast and push messages onto a VFile — no\n * mutation, no render-path involvement. Sätteri already gives us a JS\n * mdast tree; we're calling these rules directly on it.\n *\n * Locked to `runSync` so the lint engine stays synchronous (no Promise\n * propagation through `lintFile`).\n */\n\nimport { unified } from \"unified\";\nimport { VFile } from \"vfile\";\n\nimport type { MdRoot } from \"./parse.js\";\nimport type { RuleReport } from \"./rule.js\";\n\n/**\n * Wide plugin shape: each `remark-lint-*` package exports a `Plugin` with\n * different options/tree generics, which TypeScript treats as mutually\n * unassignable to the bare `Plugin` type. The runtime contract is the\n * same — accept settings, walk the tree, push messages on a VFile — so\n * we widen here and forward through the `as never` casts already\n * present in the runtime call.\n */\ntype AnyPlugin = (...args: never[]) => unknown;\n\nexport interface RemarkLintRunOptions {\n /** Source path for the VFile. Used by some rules for context, never\n * displayed by our envelope. */\n path: string;\n /** Full source text. Some remark-lint rules read this for span context. */\n source: string;\n /**\n * Plugin options forwarded to `.use(rule, ...settings)`. Mirrors\n * unified's variadic surface — a single primitive is passed through as\n * one argument; an array is spread (matching how unified parses\n * `[plugin, ...settings]` tuples). Omit when the rule takes no options.\n */\n settings?: unknown[];\n}\n\n/**\n * Run one remark-lint rule (a unified plugin) against an mdast tree and\n * collect its messages as `RuleReport[]`.\n *\n * Each VFileMessage carries `line`/`column`. We use them verbatim and\n * preserve any end-position the rule emits — this is the load-bearing\n * fidelity claim for adopting remark-lint at all. If positions drift on\n * Sätteri's tree vs remark-parse's, that's the empirical question the\n * spike answers.\n */\nexport function runRemarkLintRule(\n rule: AnyPlugin,\n tree: MdRoot,\n opts: RemarkLintRunOptions,\n): RuleReport[] {\n const file = new VFile({ path: opts.path, value: opts.source });\n\n // `runSync` is safe for any rule that's synchronous (every shipped\n // remark-lint rule we adopt should be). If a future rule is async,\n // adopting it would require routing through an async path — flag\n // explicitly rather than silently hide the latency.\n const settings = opts.settings ?? [];\n unified()\n // The `as never` cast lets us forward variadic settings without\n // unified's overload-narrowing fighting us; the runtime call\n // matches unified's documented `use(plugin, ...settings)` shape.\n .use(rule as never, ...settings)\n .runSync(tree as never, file);\n\n return file.messages.map((msg): RuleReport => {\n // `reason` is the canonical message field on VFileMessage; older\n // `message` is the alias. Prefer reason when both are present.\n const message = msg.reason || msg.message || \"\";\n\n // Position: rules attach `place` (newer) or `position` (legacy) for\n // span information. Fall back to the flat `line`/`column` fields.\n const place = (msg as { place?: unknown }).place;\n const span = positionFromPlace(place) ?? positionFromMessage(msg);\n\n return {\n message,\n line: span.line,\n column: span.column,\n endLine: span.endLine,\n endColumn: span.endColumn,\n };\n });\n}\n\ninterface SpanFields {\n line: number;\n column: number;\n endLine?: number;\n endColumn?: number;\n}\n\nfunction positionFromPlace(place: unknown): SpanFields | null {\n if (!place || typeof place !== \"object\") return null;\n const p = place as {\n start?: { line?: number; column?: number };\n end?: { line?: number; column?: number };\n line?: number;\n column?: number;\n };\n // `place` can be either a Point or a Position.\n if (p.start && typeof p.start.line === \"number\" && typeof p.start.column === \"number\") {\n const span: SpanFields = { line: p.start.line, column: p.start.column };\n if (p.end && typeof p.end.line === \"number\" && typeof p.end.column === \"number\") {\n span.endLine = p.end.line;\n span.endColumn = p.end.column;\n }\n return span;\n }\n if (typeof p.line === \"number\" && typeof p.column === \"number\") {\n return { line: p.line, column: p.column };\n }\n return null;\n}\n\nfunction positionFromMessage(msg: {\n line?: number | null;\n column?: number | null;\n}): SpanFields {\n return {\n line: typeof msg.line === \"number\" ? msg.line : 1,\n column: typeof msg.column === \"number\" ? msg.column : 1,\n };\n}\n","/**\n * nimbus/bare-url — a naked external URL in prose reads worse than a\n * descriptive link and is easy to mis-click. Flags `<https://…>`-style\n * autolinks and bare `text === url` links. Not auto-fixed: good link text\n * needs judgment.\n *\n * Detection is delegated to `remark-lint-no-literal-urls` via the\n * adapter.\n */\n\nimport remarkLintNoLiteralUrls from \"remark-lint-no-literal-urls\";\n\nimport { runRemarkLintRule } from \"../remark-lint-adapter.js\";\nimport type { Rule } from \"../rule.js\";\n\nexport const bareUrl: Rule = {\n code: \"nimbus/bare-url\",\n run(ctx) {\n const reports = runRemarkLintRule(\n remarkLintNoLiteralUrls,\n ctx.file.tree,\n { path: ctx.file.path, source: ctx.file.source },\n );\n for (const r of reports) {\n ctx.report({\n ...r,\n message:\n \"bare URL in prose — wrap it in descriptive link text: [what it is](url).\",\n });\n }\n },\n};\n","/**\n * Quote a value.\n *\n * @param value\n * Value(s) to wrap in quotes\n * @param [open='\"']\n * Opening quote\n * @param [close=open]\n * Closing quote\n */\nexport const quotation =\n /**\n * @type {{\n * (value: string, open?: string | null | undefined, close?: string | null | undefined): string\n * (value: ReadonlyArray<string>, open?: string | null | undefined, close?: string | null | undefined): string[]\n * }}\n */\n (\n /**\n * @param {ReadonlyArray<string> | string} value\n * @param {string | null | undefined} open\n * @param {string | null | undefined} close\n * @returns {Array<string> | string}\n */\n function (value, open, close) {\n const start = open || '\"'\n const end = close || start\n let index = -1\n\n if (Array.isArray(value)) {\n const list = /** @type {ReadonlyArray<string>} */ (value)\n /** @type {Array<string>} */\n const result = []\n\n while (++index < list.length) {\n result[index] = start + list[index] + end\n }\n\n return result\n }\n\n if (typeof value === 'string') {\n return start + value + end\n }\n\n throw new TypeError('Expected string or array of strings')\n }\n )\n","/**\n * @typedef {import('mdast').Html} Html\n * @typedef {import('mdast').PhrasingContent} PhrasingContent\n */\n\nimport {convert} from 'unist-util-is'\n\n/**\n * Check if the given value is *phrasing content*.\n *\n * > 👉 **Note**: Excludes `html`, which can be both phrasing or flow.\n *\n * @param node\n * Thing to check, typically `Node`.\n * @returns\n * Whether `value` is phrasing content.\n */\n\nexport const phrasing =\n /** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */\n (\n convert([\n 'break',\n 'delete',\n 'emphasis',\n // To do: next major: removed since footnotes were added to GFM.\n 'footnote',\n 'footnoteReference',\n 'image',\n 'imageReference',\n 'inlineCode',\n // Enabled by `mdast-util-math`:\n 'inlineMath',\n 'link',\n 'linkReference',\n // Enabled by `mdast-util-mdx`:\n 'mdxJsxTextElement',\n // Enabled by `mdast-util-mdx`:\n 'mdxTextExpression',\n 'strong',\n 'text',\n // Enabled by `mdast-util-directive`:\n 'textDirective'\n ])\n )\n","/**\n * remark-lint rule to warn when language flags of fenced code\n * are not used or used incorrectly.\n *\n * ## What is this?\n *\n * This package checks the language flags of fenced code blocks,\n * whether they exist,\n * and optionally what values they hold.\n *\n * Particularly,\n * it provides a check according to GitHub Linguist.\n * Which is what GitHub uses to highlight code.\n * So you can make sure that the language flags you use are recognized by\n * GitHub (or [`starry-night`][github-starry-night])\n *\n * ## When should I use this?\n *\n * You can use this package to check that the style of language flags of fenced\n * code blocks is consistent and known.\n *\n * ## API\n *\n * ### `unified().use(remarkLintFencedCodeFlag[, options])`\n *\n * Warn when language flags of fenced code are not used.\n *\n * ###### Parameters\n *\n * * `options` (`Array<string>`, [`CheckFlag`][api-check-flag], or\n * [`Options`][api-options], optional)\n * — check, configuration, or flags to allow\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * ### `checkGithubLinguistFlag(value)`\n *\n * Check according to GitHub Linguist.\n *\n * ###### Parameters\n *\n * * `value` (`string`)\n * — language flag to check\n *\n * ###### Returns\n *\n * Whether the flag is valid (`undefined`),\n * or a message to warn about (`string`).\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * ### `CheckFlag`\n *\n * Custom check (TypeScript type).\n *\n * ###### Parameters\n *\n * * `value` (`string`)\n * — language flag to check\n *\n * ###### Returns\n *\n * Whether the flag is valid (`undefined`),\n * or a message to warn about (`string`).\n *\n * ### `Options`\n *\n * Configuration (TypeScript type).\n *\n * ###### Fields\n *\n * * `allowEmpty` (`boolean`, default: `false`)\n * — allow language flags to be omitted\n * * `flags` (`Array<string>`, optional)\n * — flags to allow,\n * other flags will result in a warning\n *\n * ## Recommendation\n *\n * While omitting language flags is fine to signal that code is plain text,\n * it *could* point to a mistake.\n * It’s recommended to instead use a certain flag for plain text (such as\n * `txt`) and to turn this rule on.\n * If possible,\n * stick with what is supported by GitHub.\n *\n * [api-check-flag]: #checkflag\n * [api-options]: #options\n * [api-remark-lint-fenced-code-flag]: #unifieduseremarklintfencedcodeflag-options\n * [api-check-github-linguist-flag]: #checkgithublinguistflagvalue\n * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\n * [github-starry-night]: https://github.com/wooorm/starry-night\n *\n * @module fenced-code-flag\n * @author Titus Wormer\n * @copyright Titus Wormer\n * @license MIT\n *\n * @example\n * {\"name\": \"ok.md\"}\n *\n * Some markdown:\n *\n * ```markdown\n * # Mercury\n * ```\n *\n * @example\n * {\"label\": \"input\", \"name\": \"not-ok.md\"}\n *\n * ```\n * mercury()\n * ```\n * @example\n * {\"label\": \"output\", \"name\": \"not-ok.md\"}\n *\n * 1:1-3:4: Unexpected missing fenced code language flag in info string, expected keyword\n *\n * @example\n * {\"config\": {\"allowEmpty\": true}, \"name\": \"ok-allow-empty.md\"}\n *\n * ```\n * mercury()\n * ```\n *\n * @example\n * {\"config\": {\"allowEmpty\": false}, \"label\": \"input\", \"name\": \"not-ok-allow-empty.md\"}\n *\n * ```\n * mercury()\n * ```\n * @example\n * {\"config\": {\"allowEmpty\": false}, \"label\": \"output\", \"name\": \"not-ok-allow-empty.md\"}\n *\n * 1:1-3:4: Unexpected missing fenced code language flag in info string, expected keyword\n *\n * @example\n * {\"config\": [\"markdown\"], \"name\": \"ok-array.md\"}\n *\n * ```markdown\n * # Mercury\n * ```\n *\n * @example\n * {\"config\": {\"flags\":[\"markdown\"]}, \"name\": \"ok-options.md\"}\n *\n * ```markdown\n * # Mercury\n * ```\n *\n * @example\n * {\"config\": [\"markdown\"], \"label\": \"input\", \"name\": \"not-ok-array.md\"}\n *\n * ```javascript\n * mercury()\n * ```\n * @example\n * {\"config\": [\"markdown\"], \"label\": \"output\", \"name\": \"not-ok-array.md\"}\n *\n * 1:1-3:4: Unexpected fenced code language flag `javascript` in info string, expected `markdown`\n *\n * @example\n * {\"config\": [\"javascript\", \"markdown\", \"mdx\", \"typescript\"], \"label\": \"input\", \"name\": \"not-ok-long-array.md\"}\n *\n * ```html\n * <h1>Mercury</h1>\n * ```\n * @example\n * {\"config\": [\"javascript\", \"markdown\", \"mdx\", \"typescript\"], \"label\": \"output\", \"name\": \"not-ok-long-array.md\"}\n *\n * 1:1-3:4: Unexpected fenced code language flag `html` in info string, expected `javascript`, `markdown`, `mdx`, …\n *\n * @example\n * {\"config\": \"🌍\", \"label\": \"output\", \"name\": \"not-ok-options.md\", \"positionless\": true}\n *\n * 1:1: Unexpected value `🌍` for `options`, expected array or object\n */\n\n/**\n * @import {Root} from 'mdast'\n * @import {Info} from './github-linguist-info.js'\n */\n\n/**\n * @callback CheckFlag\n * Custom check.\n * @param {string} value\n * Language flag to check.\n * @returns {string | undefined}\n * Whether the flag is valid (`undefined`),\n * or a message to warn about (`string`).\n *\n * @typedef Options\n * Configuration.\n * @property {boolean | null | undefined} [allowEmpty=false]\n * Allow language flags to be omitted (default: `false`).\n * @property {ReadonlyArray<string> | null | undefined} [flags]\n * Flags to allow,\n * other flags will result in a warning (optional).\n */\n\nimport {quotation} from 'quotation'\nimport {phrasing} from 'mdast-util-phrasing'\nimport {lintRule} from 'unified-lint-rule'\nimport {pointEnd, pointStart} from 'unist-util-position'\nimport {SKIP, visitParents} from 'unist-util-visit-parents'\nimport {githubLinguistInfo} from './github-linguist-info.js'\n\nconst fence = /^ {0,3}([~`])\\1{2,}/\n\nconst listFormat = new Intl.ListFormat('en', {type: 'disjunction'})\nconst listFormatUnit = new Intl.ListFormat('en', {type: 'unit'})\n\nconst remarkLintFencedCodeFlag = lintRule(\n {\n origin: 'remark-lint:fenced-code-flag',\n url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-fenced-code-flag#readme'\n },\n /**\n * @param {Root} tree\n * Tree.\n * @param {CheckFlag | Readonly<Options> | ReadonlyArray<string> | null | undefined} [options]\n * Check, configuration, or flags to allow (optional).\n * @returns {undefined}\n * Nothing.\n */\n function (tree, file, options) {\n const value = String(file)\n /** @type {CheckFlag} */\n let check\n\n if (typeof options === 'function') {\n check = options\n } else if (typeof options === 'object' || options === undefined) {\n check = createCheck(options || {})\n } else {\n file.fail(\n 'Unexpected value `' +\n options +\n '` for `options`, expected array or object'\n )\n }\n\n visitParents(tree, function (node, parents) {\n // Do not walk into phrasing.\n if (phrasing(node)) {\n return SKIP\n }\n\n if (node.type !== 'code') return\n\n const language = node.lang || ''\n const end = pointEnd(node)\n const start = pointStart(node)\n\n if (\n end &&\n start &&\n typeof end.offset === 'number' &&\n typeof start.offset === 'number'\n ) {\n if (language) {\n const reason = check(language)\n if (reason) {\n file.message(reason, {\n ancestors: [...parents, node],\n place: node.position\n })\n }\n }\n // Empty, no flag.\n else {\n const slice = value.slice(start.offset, end.offset)\n\n // To do: next major: indented code shouldn’t be ok either?\n // Then, we can simplify this check.\n if (fence.test(slice)) {\n const reason = check(language)\n\n if (reason) {\n file.message(reason, {\n ancestors: [...parents, node],\n place: node.position\n })\n }\n }\n }\n }\n })\n }\n)\n\nexport default remarkLintFencedCodeFlag\n\n/**\n * @param {Readonly<Options> | ReadonlyArray<string>} options\n * @returns {CheckFlag}\n */\nfunction createCheck(options) {\n let allowEmpty = false\n /** @type {ReadonlyArray<string> | undefined} */\n let allowed\n\n // Note: casts because `isArray` and `readonly` don’t mix.\n if (Array.isArray(options)) {\n const flags = /** @type {ReadonlyArray<string>} */ (options)\n allowed = flags\n } else {\n const settings = /** @type {Options} */ (options)\n allowEmpty = settings.allowEmpty === true\n\n if (settings.flags) {\n allowed = settings.flags\n }\n }\n\n /** @type {string} */\n let allowedDisplay\n\n if (allowed) {\n allowedDisplay =\n allowed.length > 3\n ? listFormatUnit.format([...quotation(allowed.slice(0, 3), '`'), '…'])\n : listFormat.format(quotation(allowed, '`'))\n } else {\n allowedDisplay = 'keyword'\n }\n\n /** @type {CheckFlag} */\n return function (value) {\n if (value) {\n if (allowed && !allowed.includes(value)) {\n return (\n 'Unexpected fenced code language flag `' +\n value +\n '` in info string, expected ' +\n allowedDisplay\n )\n }\n } else if (!allowEmpty) {\n return (\n 'Unexpected missing fenced code language flag in info string, expected ' +\n allowedDisplay\n )\n }\n }\n}\n\n/**\n * Check according to GitHub Linguist.\n *\n * @param {string} value\n * Language flag to check.\n * @returns {string | undefined}\n * Whether the flag is valid (`undefined`),\n * or a message to warn about (`string`).\n * @satisfies {CheckFlag}\n */\nexport function checkGithubLinguistFlag(value) {\n const normal = value\n .toLowerCase()\n .replace(/^[ \\t]+/, '')\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n .replace(/\\/*[ \\t]*$/g, '')\n\n // Ignore a special flag that is not in linguist so that no highlighting will be applied.\n // `txt` is used by adblock, so that would result in some coloring.\n if (normal === 'text') {\n return\n }\n\n /** @type {Set<Info>} */\n const matches = new Set()\n const dot = normal.lastIndexOf('.')\n let known = false\n\n for (const info of githubLinguistInfo) {\n if (info.names.includes(normal)) {\n // Normalized name found: valid.\n if (value === normal) return\n known = true\n matches.add(info)\n }\n\n if (dot === -1) {\n if (info.extensions && info.extensions.includes('.' + normal)) {\n matches.add(info)\n }\n } else {\n const extension = normal.slice(dot)\n\n if (info.extensions && info.extensions.includes(extension)) {\n matches.add(info)\n }\n\n if (\n info.extensionsWithDot &&\n info.extensionsWithDot.includes(extension)\n ) {\n matches.add(info)\n }\n }\n }\n\n /** @type {Array<string>} */\n const suggestions = []\n\n for (const match of matches) {\n suggestions.push(...match.names)\n }\n\n suggestions.sort()\n\n let allowedDisplay = ''\n\n if (suggestions.length > 0) {\n allowedDisplay =\n ' such as ' +\n (suggestions.length > 5\n ? listFormatUnit.format([\n ...quotation(suggestions.slice(0, 5), '`'),\n '…'\n ])\n : listFormat.format(quotation(suggestions, '`')))\n }\n\n return (\n 'Unexpected ' +\n (known ? '' : 'unknown ') +\n 'fenced code language flag `' +\n value +\n '` in info string, expected a known language name' +\n allowedDisplay\n )\n}\n","/**\n * nimbus/code-block-lang — every fenced code block should declare a\n * language, so syntax highlighting, the copy button, and the language\n * badge all work.\n *\n * Detection is delegated to `remark-lint-fenced-code-flag` via the\n * adapter. `allow?: string[]` is accepted (and round-trips through\n * config) as the forward-compatible hook for validating against a\n * known-language set; today the rule only flags the missing-language\n * case, so any declared language passes.\n */\n\nimport remarkLintFencedCodeFlag from \"remark-lint-fenced-code-flag\";\n\nimport { runRemarkLintRule } from \"../remark-lint-adapter.js\";\nimport type { Rule } from \"../rule.js\";\n\nexport const codeBlockLang: Rule = {\n code: \"nimbus/code-block-lang\",\n run(ctx) {\n const reports = runRemarkLintRule(\n remarkLintFencedCodeFlag,\n ctx.file.tree,\n { path: ctx.file.path, source: ctx.file.source },\n );\n for (const r of reports) {\n ctx.report({\n ...r,\n message:\n 'fenced code block has no language — add one (e.g. ```ts) so highlighting, the copy button, and the language badge render.',\n });\n }\n },\n};\n","/**\n * MDX parsing for the lint engine.\n *\n * Uses Sätteri's own `mdxToMdast` — the *same parser that renders the\n * site* — so the linter never disagrees with what actually ships. No\n * shadow AST, no reintroduced unified pipeline, and the Rust parser keeps\n * the pass fast. Sätteri exposes `mdxToMdast` and unist positions\n * precisely for this kind of read-only inspection; the remark-plugin\n * no-op only affects render-time transforms wired into\n * `markdown.processor`, not direct parse calls like this one.\n */\n\nimport { mdxToMdast } from \"satteri\";\nimport { parse as parseYaml } from \"yaml\";\n\nexport interface Point {\n line: number;\n column: number;\n offset?: number;\n}\n\nexport interface NodePosition {\n start: Point;\n end: Point;\n}\n\n/**\n * A minimal mdast node view. Deliberately structural and dependency-light\n * (no `@types/mdast` coupling) — rules read the handful of fields they\n * need and tolerate the rest.\n */\nexport interface MdNode {\n type: string;\n children?: MdNode[];\n position?: NodePosition;\n value?: string;\n depth?: number;\n lang?: string | null;\n name?: string | null;\n url?: string;\n [key: string]: unknown;\n}\n\nexport interface MdRoot extends MdNode {\n type: \"root\";\n children: MdNode[];\n}\n\nexport interface ParsedFile {\n /** Path relative to the project root, for display. */\n path: string;\n /** Absolute path on disk. */\n absPath: string;\n /** Full source text. */\n source: string;\n /** Source split into lines once, reused by rules + the formatter. */\n lines: string[];\n /** mdast root from Sätteri. */\n tree: MdRoot;\n /** Raw frontmatter body (between the `---` fences), or null when absent. */\n frontmatterRaw: string | null;\n /** 1-based source line the frontmatter body starts on (the line after\n * the opening `---`). */\n frontmatterStartLine: number;\n /** Parsed frontmatter object. `null` when absent or unparseable YAML. */\n frontmatter: Record<string, unknown> | null;\n /** Collection name inferred from the path (`docs`, `partials`, …), or null. */\n collection: string | null;\n /** Set when the MDX body failed to parse (won't render). Rules are\n * skipped; the engine emits a single `nimbus/mdx-syntax` diagnostic. */\n parseError: { message: string; line: number; column: number } | null;\n}\n\n/** Depth-first walk of an mdast tree, visitor called on every node. */\nexport function visit(node: MdNode, visitor: (node: MdNode) => void): void {\n visitor(node);\n if (node.children) {\n for (const child of node.children) visit(child, visitor);\n }\n}\n\n/** Collect every node of a given `type`. */\nexport function collect(root: MdNode, type: string): MdNode[] {\n const out: MdNode[] = [];\n visit(root, (n) => {\n if (n.type === type) out.push(n);\n });\n return out;\n}\n\n/** 1-based start position of a node, falling back to (1,1). */\nexport function startOf(node: MdNode): { line: number; column: number } {\n return {\n line: node.position?.start.line ?? 1,\n column: node.position?.start.column ?? 1,\n };\n}\n\n/** Concatenated text of a node's `text` descendants. */\nexport function textOf(node: MdNode): string {\n let out = \"\";\n visit(node, (n) => {\n if (n.type === \"text\" && typeof n.value === \"string\") out += n.value;\n });\n return out;\n}\n\n/**\n * Find the first node of a given `type` whose start position matches the\n * given 1-based (line, column). Used by remark-lint wrappers to recover\n * the AST node from the rule's reported position so we can compute\n * surgical fixes or dynamic messages.\n *\n * Returns `null` when no matching node exists at that position — a defensive\n * fallback for any future tree-shape drift between remark-parse and Sätteri.\n */\nexport function findNodeAt(\n root: MdNode,\n type: string,\n line: number,\n column: number,\n): MdNode | null {\n let found: MdNode | null = null;\n visit(root, (n) => {\n if (found) return;\n if (n.type !== type) return;\n const start = n.position?.start;\n if (!start) return;\n if (start.line === line && start.column === column) found = n;\n });\n return found;\n}\n\n/**\n * Parse a source string into a `ParsedFile`. `path`/`absPath`/`collection`\n * are caller-supplied; pass-throughs for display and per-collection logic.\n */\nexport function parseSource(\n source: string,\n meta: { path: string; absPath: string; collection: string | null },\n): ParsedFile {\n let tree: MdRoot;\n let parseError: ParsedFile[\"parseError\"] = null;\n try {\n tree = mdxToMdast(source) as unknown as MdRoot;\n } catch (err) {\n // A file that won't parse won't render either — surface it instead of\n // crashing the whole lint run.\n tree = { type: \"root\", children: [] };\n parseError = describeParseError(err, source);\n }\n\n const yamlNode = tree.children.find((n) => n.type === \"yaml\");\n const frontmatterRaw =\n yamlNode && typeof yamlNode.value === \"string\" ? yamlNode.value : null;\n // The yaml node sits on the opening `---`; its body starts the next line.\n const frontmatterStartLine = (yamlNode?.position?.start.line ?? 0) + 1;\n\n let frontmatter: Record<string, unknown> | null = null;\n if (frontmatterRaw !== null) {\n try {\n const parsed = parseYaml(frontmatterRaw);\n frontmatter =\n parsed && typeof parsed === \"object\" && !Array.isArray(parsed)\n ? (parsed as Record<string, unknown>)\n : {};\n } catch {\n frontmatter = null;\n }\n }\n\n return {\n path: meta.path,\n absPath: meta.absPath,\n source,\n lines: source.split(\"\\n\"),\n tree,\n frontmatterRaw,\n frontmatterStartLine,\n frontmatter,\n collection: meta.collection,\n parseError,\n };\n}\n\n/**\n * Turn a Sätteri parse throw into a positioned message. The error text\n * carries a byte offset (`at byte N`); map it to line/column so the\n * diagnostic points at the right spot.\n */\nfunction describeParseError(\n err: unknown,\n source: string,\n): { message: string; line: number; column: number } {\n const message = err instanceof Error ? err.message : String(err);\n const byteMatch = message.match(/at byte (\\d+)/);\n let line = 1;\n let column = 1;\n if (byteMatch) {\n const byteOffset = Number(byteMatch[1]);\n const prefix = Buffer.from(source, \"utf8\")\n .subarray(0, byteOffset)\n .toString(\"utf8\");\n const prefixLines = prefix.split(\"\\n\");\n line = prefixLines.length;\n column = (prefixLines[prefixLines.length - 1]?.length ?? 0) + 1;\n }\n return { message, line, column };\n}\n","/**\n * nimbus/code-block-prompt-prefix — shell snippets that prefix commands\n * with \"$ \" break copy-paste: readers copy the prompt too. Flags shell\n * code blocks containing prompt-prefixed lines. Reported per block (the\n * fix spans many lines, so it's left to the author / a future --fix).\n */\n\nimport { collect, startOf } from \"../parse.js\";\nimport type { Rule } from \"../rule.js\";\n\nconst SHELL_LANGS = new Set([\n \"bash\",\n \"sh\",\n \"shell\",\n \"zsh\",\n \"console\",\n \"shellsession\",\n]);\n\nexport const codeBlockPromptPrefix: Rule = {\n code: \"nimbus/code-block-prompt-prefix\",\n run(ctx) {\n for (const block of collect(ctx.file.tree, \"code\")) {\n const lang = typeof block.lang === \"string\" ? block.lang.toLowerCase() : \"\";\n if (!SHELL_LANGS.has(lang)) continue;\n const value = typeof block.value === \"string\" ? block.value : \"\";\n const hasPrompt = value.split(\"\\n\").some((line) => /^\\s*\\$\\s+\\S/.test(line));\n if (!hasPrompt) continue;\n\n const at = startOf(block);\n ctx.report({\n message:\n 'shell block prefixes commands with \"$ \" — drop the prompt so readers can copy-paste the commands directly.',\n line: at.line,\n column: at.column,\n });\n }\n },\n};\n","/**\n * nimbus/description-required — every page needs a non-empty `description`.\n *\n * Distinct from `frontmatter-shape`: the framework schema marks\n * `description` as optional (so it doesn't fail the build), but a missing\n * description hurts SEO and agent indexing — a quality opinion the lint\n * carries.\n *\n * Partials are typically embedded fragments rather than pages, so projects\n * usually want to exempt them. That exemption is **configured**, not\n * hardcoded — use `collections.partials.rules: { \"nimbus/description-required\":\n * \"off\" }` in `nimbus(config, …)`. The rule itself stays collection-agnostic\n * so per-collection overrides can opt in or out per project.\n *\n * Not auto-fixable: a good description needs judgment, so the guidance\n * lives in the message rather than a synthesized `fix`.\n */\n\nimport type { Rule } from \"../rule.js\";\n\nexport const descriptionRequired: Rule = {\n code: \"nimbus/description-required\",\n run(ctx) {\n const frontmatter = ctx.file.frontmatter;\n // The unparseable / absent-YAML case belongs to frontmatter-shape.\n if (frontmatter === null) return;\n\n const description = frontmatter.description;\n if (typeof description !== \"string\" || description.trim() === \"\") {\n ctx.report({\n message:\n 'missing a non-empty \"description\" — add a one-sentence summary used for SEO meta tags and agent indexing.',\n line: ctx.file.frontmatterStartLine,\n column: 1,\n });\n }\n },\n};\n","/**\n * remark-lint rule to warn when the same text is used in multiple headings.\n *\n * ## What is this?\n *\n * This package checks that headings are unique.\n *\n * ## When should I use this?\n *\n * You can use this package to check that headings are unique.\n *\n * ## API\n *\n * ### `unified().use(remarkLintNoDuplicateHeadings)`\n *\n * Warn when the same text is used in multiple headings.\n *\n * ###### Parameters\n *\n * There are no options.\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * ## Recommendation\n *\n * Headings having unique text helps screen reader users,\n * who typically use “jump to heading” features to navigate within a page,\n * which reads headings out loud.\n *\n * It also helps because often headings receive automatic unique IDs,\n * and when the same heading text is used,\n * they are suffixed with a number based on where they are positioned in the\n * document,\n * which makes linking to them prone to changes.\n *\n * [api-remark-lint-no-duplicate-headings]: #unifieduseremarklintnoduplicateheadings\n * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\n *\n * @module no-duplicate-headings\n * @author Titus Wormer\n * @copyright Titus Wormer\n * @license MIT\n *\n * @example\n * {\"name\": \"ok.md\"}\n *\n * # Mercury\n *\n * ## Venus\n *\n * @example\n * {\"label\": \"input\", \"name\": \"not-ok.md\"}\n *\n * # Mercury\n *\n * ## Mercury\n *\n * ## [Mercury](https://example.com/mercury/)\n * @example\n * {\"label\": \"output\", \"name\": \"not-ok.md\"}\n *\n * 3:1-3:11: Unexpected heading with equivalent text, expected unique headings\n * 5:1-5:43: Unexpected heading with equivalent text, expected unique headings\n *\n * @example\n * {\"label\": \"input\", \"mdx\": true, \"name\": \"mdx.mdx\"}\n *\n * <h1>Mercury</h1>\n * <h2>Mercury</h2>\n * @example\n * {\"label\": \"output\", \"mdx\": true, \"name\": \"mdx.mdx\"}\n *\n * 2:1-2:17: Unexpected heading with equivalent text, expected unique headings\n */\n\n/**\n * @import {Nodes, Root} from 'mdast'\n * @import {} from 'mdast-util-mdx'\n */\n\nimport {ok as assert} from 'devlop'\nimport {toString} from 'mdast-util-to-string'\nimport {lintRule} from 'unified-lint-rule'\nimport {visitParents} from 'unist-util-visit-parents'\nimport {VFileMessage} from 'vfile-message'\n\nconst jsxNameRe = /^h([1-6])$/\n\nconst remarkLintNoDuplicateHeadings = lintRule(\n {\n origin: 'remark-lint:no-duplicate-headings',\n url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-duplicate-headings#readme'\n },\n /**\n * @param {Root} tree\n * Tree.\n * @returns {undefined}\n * Nothing.\n */\n function (tree, file) {\n /** @type {Map<string, Array<Nodes>>} */\n const map = new Map()\n\n visitParents(tree, function (node, parents) {\n if (\n node.type === 'heading' ||\n ((node.type === 'mdxJsxFlowElement' ||\n node.type === 'mdxJsxTextElement') &&\n node.name &&\n jsxNameRe.test(node.name))\n ) {\n const ancestors = [...parents, node]\n const value = toString(node).toLowerCase()\n const duplicateAncestors = map.get(value)\n\n if (node.position && duplicateAncestors) {\n const duplicate = duplicateAncestors.at(-1)\n assert(duplicate) // Always defined.\n\n file.message(\n 'Unexpected heading with equivalent text, expected unique headings',\n {\n ancestors,\n cause: new VFileMessage('Equivalent heading text defined here', {\n ancestors: duplicateAncestors,\n place: duplicate.position,\n source: 'remark-lint',\n ruleId: 'no-duplicate-headings'\n }),\n place: node.position\n }\n )\n }\n\n map.set(value, ancestors)\n }\n })\n }\n)\n\nexport default remarkLintNoDuplicateHeadings\n","/**\n * nimbus/duplicate-heading-text — two headings with the same text generate\n * colliding anchor slugs, so deep links land on the wrong one. Reports the\n * second (and later) occurrence. Not auto-fixable — renaming needs\n * judgment.\n *\n * Detection is delegated to `remark-lint-no-duplicate-headings` via the\n * adapter. The wrapper re-walks the tree at each reported position to\n * recover the duplicate heading's text (and the first occurrence's line)\n * for the message — the dynamic info matters for navigability.\n */\n\nimport remarkLintNoDuplicateHeadings from \"remark-lint-no-duplicate-headings\";\n\nimport { collect, findNodeAt, startOf, textOf } from \"../parse.js\";\nimport { runRemarkLintRule } from \"../remark-lint-adapter.js\";\nimport type { Rule } from \"../rule.js\";\n\nexport const duplicateHeadingText: Rule = {\n code: \"nimbus/duplicate-heading-text\",\n run(ctx) {\n const reports = runRemarkLintRule(\n remarkLintNoDuplicateHeadings,\n ctx.file.tree,\n { path: ctx.file.path, source: ctx.file.source },\n );\n\n if (reports.length === 0) return;\n\n // Build a map of normalized heading text → first occurrence line so\n // we can reproduce the \"(first used on line N)\" hint the\n // hand-rolled rule emitted.\n const firstSeen = new Map<string, number>();\n for (const heading of collect(ctx.file.tree, \"heading\")) {\n const key = textOf(heading).trim().toLowerCase();\n if (key === \"\") continue;\n if (!firstSeen.has(key)) firstSeen.set(key, startOf(heading).line);\n }\n\n for (const r of reports) {\n const heading = findNodeAt(ctx.file.tree, \"heading\", r.line, r.column);\n if (!heading) {\n ctx.report({\n ...r,\n message:\n \"duplicate heading text — duplicate headings produce colliding anchor links.\",\n });\n continue;\n }\n const text = textOf(heading).trim();\n const first = firstSeen.get(text.toLowerCase());\n ctx.report({\n ...r,\n message:\n first !== undefined && first !== r.line\n ? `duplicate heading \"${text}\" (first used on line ${first}) — duplicate headings produce colliding anchor links.`\n : `duplicate heading \"${text}\" — duplicate headings produce colliding anchor links.`,\n });\n }\n },\n};\n","/**\n * remark-lint rule to warn when emphasis markers are inconsistent.\n *\n * ## What is this?\n *\n * This package checks the style of emphasis markers.\n *\n * ## When should I use this?\n *\n * You can use this package to check that emphasis is consistent.\n *\n * ## API\n *\n * ### `unified().use(remarkLintEmphasisMarker[, options])`\n *\n * Warn when emphasis markers are inconsistent.\n *\n * ###### Parameters\n *\n * * `options` ([`Options`][api-options], default: `'consistent'`)\n * — preferred style or whether to detect the first style and warn for\n * further differences\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * ### `Marker`\n *\n * Marker (TypeScript type).\n *\n * ###### Type\n *\n * ```ts\n * type Marker = '*' | '_'\n * ```\n *\n * ### `Options`\n *\n * Configuration (TypeScript type).\n *\n * ###### Type\n *\n * ```ts\n * type Options = Marker | 'consistent'\n * ```\n *\n * ## Recommendation\n *\n * Whether asterisks or underscores are used affects how and whether emphasis\n * works.\n * Underscores are sometimes used to represent normal underscores inside words,\n * so there are extra rules in markdown to support that.\n * Asterisks are not used in natural language,\n * so they don’t need these rules,\n * and thus can form emphasis in more cases.\n * Asterisks can also be used as the marker of more constructs than underscores:\n * lists.\n * Due to having simpler parsing rules,\n * looking more like syntax,\n * and that they can be used for more constructs,\n * it’s recommended to prefer asterisks.\n *\n * ## Fix\n *\n * [`remark-stringify`][github-remark-stringify] formats emphasis with\n * asterisks by default.\n * Pass `emphasis: '_'` to always use underscores.\n *\n * [api-marker]: #marker\n * [api-options]: #options\n * [api-remark-lint-emphasis-marker]: #unifieduseremarklintemphasismarker-options\n * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify\n * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\n *\n * @module emphasis-marker\n * @author Titus Wormer\n * @copyright Titus Wormer\n * @license MIT\n *\n * @example\n * {\"config\": \"*\", \"name\": \"ok-asterisk.md\"}\n *\n * *Mercury*.\n *\n * @example\n * {\"config\": \"*\", \"label\": \"input\", \"name\": \"not-ok-asterisk.md\"}\n *\n * _Mercury_.\n *\n * @example\n * {\"config\": \"*\", \"label\": \"output\", \"name\": \"not-ok-asterisk.md\"}\n *\n * 1:1-1:10: Unexpected emphasis marker `_`, expected `*`\n *\n * @example\n * {\"config\": \"_\", \"name\": \"ok-underscore.md\"}\n *\n * _Mercury_.\n *\n * @example\n * {\"config\": \"_\", \"label\": \"input\", \"name\": \"not-ok-underscore.md\"}\n *\n * *Mercury*.\n *\n * @example\n * {\"config\": \"_\", \"label\": \"output\", \"name\": \"not-ok-underscore.md\"}\n *\n * 1:1-1:10: Unexpected emphasis marker `*`, expected `_`\n *\n * @example\n * {\"label\": \"input\", \"name\": \"not-ok-consistent.md\"}\n *\n * *Mercury* and _Venus_.\n *\n * @example\n * {\"label\": \"output\", \"name\": \"not-ok-consistent.md\"}\n *\n * 1:15-1:22: Unexpected emphasis marker `_`, expected `*`\n *\n * @example\n * {\"config\": \"🌍\", \"label\": \"output\", \"name\": \"not-ok.md\", \"positionless\": true}\n *\n * 1:1: Unexpected value `🌍` for `options`, expected `'*'`, `'_'`, or `'consistent'`\n */\n\n/**\n * @import {Root} from 'mdast'\n */\n\n/**\n * @typedef {'*' | '_'} Marker\n * Styles.\n *\n * @typedef {Marker | 'consistent'} Options\n * Configuration.\n */\n\nimport {lintRule} from 'unified-lint-rule'\nimport {pointStart} from 'unist-util-position'\nimport {visitParents} from 'unist-util-visit-parents'\nimport {VFileMessage} from 'vfile-message'\n\nconst remarkLintEmphasisMarker = lintRule(\n {\n origin: 'remark-lint:emphasis-marker',\n url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-emphasis-marker#readme'\n },\n /**\n * @param {Root} tree\n * Tree.\n * @param {Options | null | undefined} [options='consistent']\n * Configuration (default: `'consistent`').\n * @returns {undefined}\n * Nothing.\n */\n function (tree, file, options) {\n const value = String(file)\n /** @type {VFileMessage | undefined} */\n let cause\n /** @type {Marker | undefined} */\n let expected\n\n if (options === null || options === undefined || options === 'consistent') {\n // Empty.\n } else if (options === '*' || options === '_') {\n expected = options\n } else {\n file.fail(\n 'Unexpected value `' +\n options +\n \"` for `options`, expected `'*'`, `'_'`, or `'consistent'`\"\n )\n }\n\n visitParents(tree, 'emphasis', function (node, parents) {\n const start = pointStart(node)\n\n if (start && typeof start.offset === 'number') {\n const actual = value.charAt(start.offset)\n\n /* c8 ignore next -- should not happen. */\n if (actual !== '*' && actual !== '_') return\n\n if (expected) {\n if (actual !== expected) {\n file.message(\n 'Unexpected emphasis marker `' +\n actual +\n '`, expected `' +\n expected +\n '`',\n {ancestors: [...parents, node], cause, place: node.position}\n )\n }\n } else {\n expected = actual\n cause = new VFileMessage(\n \"Emphasis marker style `'\" +\n actual +\n \"'` first defined for `'consistent'` here\",\n {\n ancestors: [...parents, node],\n place: node.position,\n ruleId: 'emphasis-marker',\n source: 'remark-lint'\n }\n )\n }\n }\n })\n }\n)\n\nexport default remarkLintEmphasisMarker\n","/**\n * nimbus/emphasis-style — consistent italic delimiter. `style?:\n * \"asterisk\" | \"underscore\"` (default `asterisk`). Auto-fixable: swap both\n * delimiters. Targets italic (`emphasis`); bold (`strong`) is left alone.\n *\n * Detection is delegated to `remark-lint-emphasis-marker` via the\n * adapter (configured with the chosen marker). The wrapper re-walks the\n * tree at each reported position to recover both delimiter offsets for\n * the two-edit surgical fix.\n */\n\nimport remarkLintEmphasisMarker from \"remark-lint-emphasis-marker\";\n\nimport { findNodeAt } from \"../parse.js\";\nimport { runRemarkLintRule } from \"../remark-lint-adapter.js\";\nimport type { Rule } from \"../rule.js\";\n\nconst DELIM = { asterisk: \"*\", underscore: \"_\" } as const;\n\nexport const emphasisStyle: Rule = {\n code: \"nimbus/emphasis-style\",\n run(ctx) {\n const style = ctx.options.style === \"underscore\" ? \"underscore\" : \"asterisk\";\n const want = DELIM[style];\n\n const reports = runRemarkLintRule(\n remarkLintEmphasisMarker,\n ctx.file.tree,\n {\n path: ctx.file.path,\n source: ctx.file.source,\n settings: [want],\n },\n );\n\n for (const r of reports) {\n const node = findNodeAt(ctx.file.tree, \"emphasis\", r.line, r.column);\n const start = node?.position?.start.offset;\n const end = node?.position?.end.offset;\n if (typeof start !== \"number\" || typeof end !== \"number\") {\n ctx.report({\n ...r,\n message: `italic delimiter should be \"${want}\".`,\n });\n continue;\n }\n const open = ctx.file.source[start];\n if (open !== \"_\" && open !== \"*\") {\n ctx.report({\n ...r,\n message: `italic delimiter should be \"${want}\".`,\n });\n continue;\n }\n\n ctx.report({\n ...r,\n message: `italic uses \"${open}…${open}\" — this project's emphasis marker is \"${want}\".`,\n fix: {\n description: `change the \"${open}\" delimiters to \"${want}\"`,\n edits: [\n { range: [start, start + 1], text: want },\n { range: [end - 1, end], text: want },\n ],\n },\n });\n }\n },\n};\n","/**\n * Adapter: a Zod error → `RuleReport[]`, with each issue mapped onto the\n * line of the offending frontmatter key. Consumed by\n * `nimbus/frontmatter-shape`; kept separate so any future rule that\n * validates structured data through Zod can route through the same shape.\n *\n * Typed structurally against the ZodError surface we use (just `issues`)\n * so it doesn't pin a specific `astro/zod` version.\n */\n\nimport type { RuleReport } from \"./rule.js\";\n\ninterface ZodIssueLike {\n path: ReadonlyArray<PropertyKey>;\n message: string;\n}\n\ninterface ZodErrorLike {\n issues: ReadonlyArray<ZodIssueLike>;\n}\n\n/**\n * Convert each Zod issue into a report. The position is resolved by\n * locating the top-level frontmatter key in the raw YAML; falls back to\n * the first frontmatter line when the key can't be found (e.g. a missing\n * required field, or a nested path whose root key was omitted).\n */\nexport function zodErrorToReports(\n error: ZodErrorLike,\n opts: { frontmatterRaw: string; frontmatterStartLine: number },\n): RuleReport[] {\n return error.issues.map((issue) => {\n const dottedPath = issue.path\n .filter((p): p is string | number => typeof p !== \"symbol\")\n .join(\".\");\n const rootKey = issue.path.find((p): p is string => typeof p === \"string\");\n const { line, column } = locateKey(\n opts.frontmatterRaw,\n rootKey,\n opts.frontmatterStartLine,\n );\n const label = dottedPath.length > 0 ? dottedPath : \"(frontmatter)\";\n return { message: `${label}: ${issue.message}`, line, column };\n });\n}\n\n/**\n * Find the 1-based source line/column of a top-level YAML key. The column\n * points at the start of the key. Returns the frontmatter's first line at\n * column 1 when the key isn't present.\n */\nfunction locateKey(\n frontmatterRaw: string,\n key: string | undefined,\n startLine: number,\n): { line: number; column: number } {\n if (key) {\n const rawLines = frontmatterRaw.split(\"\\n\");\n const pattern = new RegExp(`^(\\\\s*)${escapeRegExp(key)}\\\\s*:`);\n for (let i = 0; i < rawLines.length; i++) {\n const match = rawLines[i]!.match(pattern);\n if (match) {\n return { line: startLine + i, column: match[1]!.length + 1 };\n }\n }\n }\n return { line: startLine, column: 1 };\n}\n\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n","/**\n * nimbus/frontmatter-shape — validate frontmatter against the framework's\n * content schema via the Zod-to-diagnostic adapter.\n *\n * Runs in *lenient* (passthrough) mode: it checks the types of the fields\n * Nimbus owns (title is a string, draft is a boolean, sidebar.order is a\n * number, …) but tolerates user-added fields, because the standalone CLI\n * can't yet see a site's extended `content.config.ts` schema. Lint\n * directive keys (`nimbusDisableRules`) are stripped before validation —\n * they're tooling, not content.\n */\n\nimport { lenientDocsSchema, lenientPartialsSchema } from \"../../schemas.js\";\nimport type { Rule } from \"../rule.js\";\nimport { zodErrorToReports } from \"../zod-adapter.js\";\n\nconst LINT_DIRECTIVE_KEYS = [\"nimbusDisableRules\"];\n\nexport const frontmatterShape: Rule = {\n code: \"nimbus/frontmatter-shape\",\n run(ctx) {\n const { frontmatter, frontmatterRaw, frontmatterStartLine } = ctx.file;\n\n // Raw frontmatter present but YAML parse failed — report that, since\n // every downstream check depends on a parseable object.\n if (frontmatter === null) {\n if (frontmatterRaw !== null) {\n ctx.report({\n message: \"frontmatter is present but is not valid YAML.\",\n line: frontmatterStartLine,\n column: 1,\n });\n }\n return;\n }\n\n const subject: Record<string, unknown> = { ...frontmatter };\n for (const key of LINT_DIRECTIVE_KEYS) delete subject[key];\n\n const schema =\n ctx.file.collection === \"partials\"\n ? lenientPartialsSchema\n : lenientDocsSchema;\n\n const result = schema.safeParse(subject);\n if (!result.success) {\n const reports = zodErrorToReports(result.error, {\n frontmatterRaw: frontmatterRaw ?? \"\",\n frontmatterStartLine,\n });\n for (const report of reports) ctx.report(report);\n }\n },\n};\n","/**\n * remark-lint rule to warn when heading ranks increment with more than\n * 1 at a time.\n *\n * ## What is this?\n *\n * This package checks the increase of headings.\n *\n * ## When should I use this?\n *\n * You can use this package to check the increase of headings.\n *\n * ## API\n *\n * ### `unified().use(remarkLintHeadingIncrement)`\n *\n * Warn when heading ranks increment with more than 1 at a time.\n *\n * ###### Parameters\n *\n * There are no options.\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * ## Recommendation\n *\n * While markdown is not only used for HTML,\n * HTML accessibility guidelines state that headings should increment by one at\n * a time.\n * As in,\n * say the previous heading had a rank of 2 (so `<h2>`),\n * then the following heading that is to be considered “inside” it should have\n * a rank of 3 (`<h3>`).\n * Due to this,\n * when HTML output is a goal of the document,\n * it’s recommended that this rule is turned on.\n *\n * [api-remark-lint-heading-increment]: #unifieduseremarklintheadingincrement\n * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\n *\n * @module heading-increment\n * @author Titus Wormer\n * @copyright Titus Wormer\n * @license MIT\n *\n * @example\n * {\"name\": \"ok.md\"}\n *\n * # Mercury\n *\n * ## Nomenclature\n *\n * @example\n * {\"name\": \"also-ok.md\"}\n *\n * #### Impact basins and craters\n *\n * #### Plains\n *\n * #### Compressional features\n *\n * @example\n * {\"label\": \"input\", \"name\": \"not-ok.md\"}\n *\n * # Mercury\n *\n * ### Internal structure\n *\n * ### Surface geology\n *\n * ## Observation history\n *\n * #### Mariner 10\n *\n * @example\n * {\"label\": \"output\", \"name\": \"not-ok.md\"}\n *\n * 3:1-3:23: Unexpected heading rank `3`, exected rank `2`\n * 5:1-5:20: Unexpected heading rank `3`, exected rank `2`\n * 9:1-9:16: Unexpected heading rank `4`, exected rank `3`\n *\n * @example\n * {\"label\": \"input\", \"name\": \"html.md\"}\n *\n * # Mercury\n *\n * <b>Mercury</b> is the first planet from the Sun and the smallest\n * in the Solar System.\n *\n * <h3>Internal structure</h3>\n *\n * <h2>Orbit, rotation, and longitude</h2>\n * @example\n * {\"label\": \"output\", \"name\": \"html.md\"}\n *\n * 6:1-6:28: Unexpected heading rank `3`, exected rank `2`\n *\n * @example\n * {\"mdx\": true, \"name\": \"mdx.mdx\"}\n *\n * # Mercury\n *\n * <b>Mercury</b> is the first planet from the Sun and the smallest\n * in the Solar System.\n *\n * <h3>Internal structure</h3>\n *\n * <h2>Orbit, rotation, and longitude</h2>\n * @example\n * {\"label\": \"output\", \"mdx\": true, \"name\": \"mdx.mdx\"}\n *\n * 6:1-6:28: Unexpected heading rank `3`, exected rank `2`\n */\n\n/**\n * @import {Heading, Nodes, Root} from 'mdast'\n * @import {} from 'mdast-util-mdx'\n */\n\nimport {ok as assert} from 'devlop'\nimport {lintRule} from 'unified-lint-rule'\nimport {visitParents} from 'unist-util-visit-parents'\nimport {VFileMessage} from 'vfile-message'\n\nconst htmlRe = /<h([1-6])/\nconst jsxNameRe = /^h([1-6])$/\n\nconst remarkLintHeadingIncrement = lintRule(\n {\n origin: 'remark-lint:heading-increment',\n url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-heading-increment#readme'\n },\n /**\n * @param {Root} tree\n * Tree.\n * @returns {undefined}\n * Nothing.\n */\n function (tree, file) {\n /** @type {Array<Array<Nodes> | undefined>} */\n const stack = []\n\n visitParents(tree, function (node, parents) {\n const rank = inferRank(node)\n\n if (rank) {\n let index = rank\n /** @type {Array<Nodes> | undefined} */\n let closestAncestors\n\n while (index--) {\n if (stack[index]) {\n closestAncestors = stack[index]\n break\n }\n }\n\n if (closestAncestors) {\n const parent = closestAncestors.at(-1)\n assert(parent) // Always defined.\n const parentRank = inferRank(parent)\n assert(parentRank) // Always defined.\n\n if (node.position && rank > parentRank + 1) {\n file.message(\n 'Unexpected heading rank `' +\n rank +\n '`, exected rank `' +\n (parentRank + 1) +\n '`',\n {\n ancestors: [...parents, node],\n cause: new VFileMessage('Parent heading defined here', {\n ancestors: closestAncestors,\n place: parent.position,\n source: 'remark-lint',\n ruleId: 'heading-increment'\n }),\n place: node.position\n }\n )\n }\n }\n\n stack[rank] = [...parents, node]\n // Drop things after it.\n stack.length = rank + 1\n }\n })\n }\n)\n\nexport default remarkLintHeadingIncrement\n\n/**\n * Get rank of a node.\n *\n * @param {Nodes} node\n * Node.\n * @returns {Heading['depth'] | undefined}\n * Rank, if heading.\n */\nfunction inferRank(node) {\n /** @type {Heading['depth'] | undefined} */\n let rank\n\n if (node.type === 'heading') {\n rank = node.depth\n } else if (node.type === 'html') {\n const results = node.value.match(htmlRe)\n rank = results\n ? /** @type {Heading['depth']} */ (Number(results[1]))\n : undefined\n } else if (\n (node.type === 'mdxJsxFlowElement' || node.type === 'mdxJsxTextElement') &&\n node.name\n ) {\n const results = node.name.match(jsxNameRe)\n rank = results\n ? /** @type {Heading['depth']} */ (Number(results[1]))\n : undefined\n }\n\n return rank\n}\n","/**\n * nimbus/heading-hierarchy — headings shouldn't skip levels. Going from an\n * H2 straight to an H4 breaks the document outline (and screen-reader\n * navigation). Reports the heading that does the skipping.\n *\n * Detection is delegated to `remark-lint-heading-increment` via the\n * adapter. The wrapper re-walks the tree at each reported position to\n * find the offending heading and its predecessor, then constructs the\n * dynamic message (\"h2 to h4 — use h3 instead\") the hand-rolled rule\n * emitted.\n */\n\nimport remarkLintHeadingIncrement from \"remark-lint-heading-increment\";\n\nimport { collect } from \"../parse.js\";\nimport { runRemarkLintRule } from \"../remark-lint-adapter.js\";\nimport type { Rule } from \"../rule.js\";\n\nexport const headingHierarchy: Rule = {\n code: \"nimbus/heading-hierarchy\",\n run(ctx) {\n const reports = runRemarkLintRule(\n remarkLintHeadingIncrement,\n ctx.file.tree,\n { path: ctx.file.path, source: ctx.file.source },\n );\n\n if (reports.length === 0) return;\n\n const headings = collect(ctx.file.tree, \"heading\");\n\n for (const r of reports) {\n const idx = headings.findIndex((h) => {\n const p = h.position?.start;\n return p?.line === r.line && p?.column === r.column;\n });\n\n if (idx <= 0) {\n // Defensive: no predecessor (or position drifted) — fall back to\n // a static message rather than misreport the levels.\n ctx.report({\n ...r,\n message:\n \"heading level skips — don't jump past a level. Insert the missing depth instead.\",\n });\n continue;\n }\n\n const prevDepth = headings[idx - 1]!.depth ?? 1;\n const curDepth = headings[idx]!.depth ?? 1;\n ctx.report({\n ...r,\n message: `heading level jumps from h${prevDepth} to h${curDepth} — don't skip levels; use h${prevDepth + 1} instead.`,\n });\n }\n },\n};\n","/**\n * remark-lint rule to warn when headings end in irregular characters.\n *\n * ## What is this?\n *\n * This package checks heading text.\n *\n * ## When should I use this?\n *\n * You can use this package to check that heading text is consistent.\n *\n * ## API\n *\n * ### `unified().use(remarkLintNoHeadingPunctuation[, options])`\n *\n * Warn when headings end in irregular characters.\n *\n * ###### Parameters\n *\n * * `options` (`RegExp` or `string`, default: `/[!,.:;?]/u`)\n * — configuration,\n * when string wrapped in `new RegExp('[' + x + ']', 'u')` so make sure to\n * escape regexp characters\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * [api-remark-lint-no-heading-punctuation]: #unifieduseremarklintnoheadingpunctuation-options\n * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\n *\n * @module no-heading-punctuation\n * @author Titus Wormer\n * @copyright Titus Wormer\n * @license MIT\n *\n * @example\n * {\"name\": \"ok.md\"}\n *\n * # Mercury\n *\n * @example\n * {\"label\": \"input\", \"name\": \"not-ok.md\"}\n *\n * # Mercury:\n *\n * # Venus?\n *\n * # Earth!\n *\n * # Mars,\n *\n * # Jupiter;\n * @example\n * {\"label\": \"output\", \"name\": \"not-ok.md\"}\n *\n * 1:1-1:11: Unexpected character `:` at end of heading, remove it\n * 3:1-3:9: Unexpected character `?` at end of heading, remove it\n * 5:1-5:9: Unexpected character `!` at end of heading, remove it\n * 7:1-7:8: Unexpected character `,` at end of heading, remove it\n * 9:1-9:11: Unexpected character `;` at end of heading, remove it\n *\n * @example\n * {\"config\": \",;:!?\", \"name\": \"ok.md\"}\n *\n * # Mercury…\n *\n * @example\n * {\"config\": {\"source\": \"[^A-Za-z0-9]\"}, \"label\": \"input\", \"name\": \"regex.md\"}\n *\n * # Mercury!\n * @example\n * {\"config\": {\"source\": \"[^A-Za-z0-9]\"}, \"label\": \"output\", \"name\": \"regex.md\"}\n *\n * 1:1-1:11: Unexpected character `!` at end of heading, remove it\n *\n * @example\n * {\"label\": \"input\", \"mdx\": true, \"name\": \"example.mdx\"}\n *\n * <h1>Mercury?</h1>\n * @example\n * {\"label\": \"output\", \"mdx\": true, \"name\": \"example.mdx\"}\n *\n * 1:1-1:18: Unexpected character `?` at end of heading, remove it\n *\n * @example\n * {\"config\": 1, \"label\": \"output\", \"name\": \"not-ok-options.md\", \"positionless\": true}\n *\n * 1:1: Unexpected value `1` for `options`, expected `RegExp` or `string`\n */\n\n/**\n * @import {Root} from 'mdast'\n * @import {} from 'mdast-util-mdx'\n */\n\nimport {toString} from 'mdast-util-to-string'\nimport {lintRule} from 'unified-lint-rule'\nimport {visitParents} from 'unist-util-visit-parents'\n\nconst jsxNameRe = /^h([1-6])$/\nconst defaultExpression = /[!,.:;?]/u\n\nconst remarkLintNoHeadingPunctuation = lintRule(\n {\n origin: 'remark-lint:no-heading-punctuation',\n url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-heading-punctuation#readme'\n },\n /**\n * @param {Root} tree\n * Tree.\n * @param {RegExp | string | null | undefined} [options]\n * Configuration (default: `/[!,.:;?]/u`),\n * wrapped in `new RegExp('[' + x + ']', 'u')` so make sure to double escape\n * regexp characters.\n * @returns {undefined}\n * Nothing.\n */\n function (tree, file, options) {\n let expected = defaultExpression\n\n if (options === null || options === undefined) {\n // Empty.\n } else if (typeof options === 'string') {\n expected = new RegExp('[' + options + ']', 'u')\n } else if (typeof options === 'object' && 'source' in options) {\n expected = new RegExp(options.source, options.flags ?? 'u')\n } else {\n file.fail(\n 'Unexpected value `' +\n options +\n '` for `options`, expected `RegExp` or `string`'\n )\n }\n\n visitParents(tree, function (node, parents) {\n if (\n node.position && // Plain markdown.\n (node.type === 'heading' ||\n // MDX JSX.\n ((node.type === 'mdxJsxFlowElement' ||\n node.type === 'mdxJsxTextElement') &&\n node.name &&\n jsxNameRe.test(node.name)))\n ) {\n const tail = Array.from(toString(node)).at(-1)\n\n if (tail && expected.test(tail)) {\n file.message(\n 'Unexpected character `' + tail + '` at end of heading, remove it',\n {ancestors: [...parents, node], place: node.position}\n )\n }\n }\n })\n }\n)\n\nexport default remarkLintNoHeadingPunctuation\n","/**\n * nimbus/heading-punctuation — headings shouldn't end in trailing\n * punctuation (`.`, `,`, `:`, `;`, `!`). Question marks are allowed —\n * \"How do I…?\" is a legitimate heading. Auto-fixable: strip the trailing\n * punctuation.\n *\n * Detection is delegated to `remark-lint-no-heading-punctuation` via the\n * adapter. The plugin's default disallowed set is `.,;:!?`; we override\n * with `.,;:!` so `?` headings stay legitimate — the policy lives in the\n * plugin's options, not in a post-filter that would silently mask any\n * future detection improvement.\n *\n * The wrapper re-walks the tree at each reported position to recover the\n * heading node, then builds the dynamic message (which names the trailing\n * punct) and the surgical fix (which strips it).\n */\n\nimport remarkLintNoHeadingPunctuation from \"remark-lint-no-heading-punctuation\";\n\nimport { collect, findNodeAt, textOf } from \"../parse.js\";\nimport { runRemarkLintRule } from \"../remark-lint-adapter.js\";\nimport type { Rule } from \"../rule.js\";\n\n/** Punctuation the rule treats as offending — `?` is intentionally absent. */\nconst DISALLOWED = \".,;:!\";\n\n/** Matches a run of disallowed chars at the end of a string. */\nconst TRAILING = new RegExp(\n `[${DISALLOWED.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")}]+$`,\n);\n\nexport const headingPunctuation: Rule = {\n code: \"nimbus/heading-punctuation\",\n run(ctx) {\n const reports = runRemarkLintRule(\n remarkLintNoHeadingPunctuation,\n ctx.file.tree,\n {\n path: ctx.file.path,\n source: ctx.file.source,\n // Pin the disallowed set — default is `.,;:!?`; we drop `?`.\n settings: [DISALLOWED],\n },\n );\n\n for (const r of reports) {\n const heading = findNodeAt(ctx.file.tree, \"heading\", r.line, r.column);\n if (!heading) {\n // Defensive: position drift means we can't reconstruct the\n // dynamic message or the fix. Emit the rule's generic message\n // rather than swallow the diagnostic.\n ctx.report({\n ...r,\n message:\n \"heading ends with trailing punctuation — drop it from the heading.\",\n });\n continue;\n }\n\n const texts = collect(heading, \"text\");\n const last = texts[texts.length - 1];\n const value = typeof last?.value === \"string\" ? last.value : \"\";\n const match = value.match(TRAILING);\n const end = last?.position?.end.offset;\n\n if (!match || typeof end !== \"number\") {\n // remark-lint flagged the heading but our text walk can't find\n // the trailing punct on the last text node — likely because the\n // heading ends with an inline node we don't peer into (a code\n // span, link text, etc.). Emit the diagnostic without a fix.\n ctx.report({\n ...r,\n message: `heading \"${textOf(heading).trim()}\" ends with trailing punctuation — drop it from the heading.`,\n });\n continue;\n }\n\n const punct = match[0];\n ctx.report({\n ...r,\n message: `heading \"${textOf(heading).trim()}\" ends with \"${punct}\" — drop trailing punctuation from headings.`,\n fix: {\n description: `remove the trailing \"${punct}\"`,\n edits: [{ range: [end - punct.length, end], text: \"\" }],\n },\n });\n }\n },\n};\n","/**\n * Tiny Levenshtein distance + \"did you mean\" suggester.\n *\n * Used by the MDX PascalCase validator and any framework diagnostic that\n * wants to suggest a near-match on a misspelled name. Kept internal — user\n * code that wants the same hint duplicates ~10 lines rather than depending\n * on a framework wrapper. See the north-star guardrail on thin wrappers.\n */\n\nexport function levenshtein(a: string, b: string): number {\n if (a === b) return 0;\n if (a.length === 0) return b.length;\n if (b.length === 0) return a.length;\n const v0 = new Array<number>(b.length + 1);\n const v1 = new Array<number>(b.length + 1);\n // `!` on every indexed read: arrays are pre-allocated to length b.length+1\n // and every index used here is loop-bounded within that range.\n for (let i = 0; i <= b.length; i++) v0[i] = i;\n for (let i = 0; i < a.length; i++) {\n v1[0] = i + 1;\n for (let j = 0; j < b.length; j++) {\n const cost = a[i] === b[j] ? 0 : 1;\n v1[j + 1] = Math.min(v1[j]! + 1, v0[j + 1]! + 1, v0[j]! + cost);\n }\n for (let j = 0; j <= b.length; j++) v0[j] = v1[j]!;\n }\n return v1[b.length]!;\n}\n\n/**\n * Return the closest candidate within `maxDist`, or null.\n *\n * Comparison is case-insensitive (so \"tabs\" suggests \"Tabs\"), but the\n * returned name keeps its original casing.\n */\nexport function suggest(\n target: string,\n candidates: Iterable<string>,\n maxDist = 3,\n): string | null {\n const targetLower = target.toLowerCase();\n let best: { name: string; dist: number } | null = null;\n for (const c of candidates) {\n const dist = levenshtein(targetLower, c.toLowerCase());\n if (dist <= maxDist && (!best || dist < best.dist)) {\n best = { name: c, dist };\n }\n }\n return best?.name ?? null;\n}\n","/**\n * nimbus/image-ref — image references that don't resolve to a file on\n * disk. Unlike `internal-link` (whose truth is the emergent route set,\n * materialized at build time), image truth is just the filesystem: a\n * site-absolute ref maps to `public/`, a relative ref to the authoring\n * file's directory. No build prerequisite, no silent-skip machinery.\n *\n * Coverage:\n * - `image` nodes (``)\n * - `imageReference` nodes (`![alt][ref]` resolved against `definition`s)\n * - MDX JSX `<img src=\"...\">`\n * - Extra JSX components opt-in via `components: [{ name, attr }, …]` —\n * same shape as `internal-link`'s option, same rationale: component\n * names belong to the user.\n *\n * Resolution:\n * - `/foo.png` → `<root>/public/foo.png` (Astro serves `public/` at the\n * site root).\n * - `./shot.png` / `../img.png` → relative to the MDX file (Astro's image\n * pipeline resolves these as imports — they're valid and checkable).\n * - `aliases: { \"~/assets/\": \"src/assets/\" }` maps prefix → root-relative\n * directory. The framework ships none by default — `~/` is a per-project\n * tsconfig path, not a framework concept.\n * - External URLs (any scheme, incl. `data:`, and `//`) are skipped —\n * remote existence checks are a network concern, not a lint.\n * - Dynamic JSX attrs (`<img src={x}>`) are skipped — not checkable.\n *\n * A miss whose containing directory exists produces a \"did you mean\" hint\n * from that directory's entries via Levenshtein distance.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { suggest } from \"../../_internal/levenshtein.js\";\nimport { collect, startOf, visit, type MdNode } from \"../parse.js\";\nimport type { Rule } from \"../rule.js\";\n\nexport const imageRef: Rule = {\n code: \"nimbus/image-ref\",\n run(ctx) {\n const root = inferProjectRoot(ctx.file.absPath);\n const aliases = readAliases(ctx.options.aliases);\n const ignore = Array.isArray(ctx.options.ignore)\n ? ctx.options.ignore.filter((s): s is string => typeof s === \"string\")\n : [];\n const extraComponents = readExtraComponents(ctx.options.components);\n const definitions = collectDefinitions(ctx.file.tree);\n\n for (const occ of collectImageOccurrences(\n ctx.file.tree,\n definitions,\n extraComponents,\n )) {\n const url = occ.url;\n if (!url) continue;\n if (isExternal(url)) continue;\n\n const cleaned = cleanUrl(url);\n if (cleaned === \"\") continue;\n if (matchesAnyIgnore(cleaned, ignore)) continue;\n\n const resolved = resolveToDisk(cleaned, root, ctx.file.absPath, aliases);\n if (resolved === null) continue; // unrecognised shape — silence beats false-positive\n if (fileExists(resolved.fullPath)) continue;\n\n const hint = suggestSibling(resolved.fullPath);\n ctx.report({\n message: hint\n ? `missing image \"${url}\" — expected at ${resolved.display}; did you mean \"${hint}\"?`\n : `missing image \"${url}\" — expected at ${resolved.display}.`,\n line: occ.line,\n column: occ.column,\n });\n }\n },\n};\n\n// ---------------------------------------------------------------------------\n// AST traversal\n// ---------------------------------------------------------------------------\n\ninterface ImageOccurrence {\n url: string;\n line: number;\n column: number;\n}\n\ninterface ComponentSpec {\n name: string;\n attr: string;\n}\n\n/**\n * `<img src>` is always checked — a plain img means the same thing in\n * every MDX file. Extra components come from the `components` option.\n */\nfunction readExtraComponents(value: unknown): ComponentSpec[] {\n if (!Array.isArray(value)) return [];\n const out: ComponentSpec[] = [];\n for (const item of value) {\n if (!item || typeof item !== \"object\") continue;\n const obj = item as { name?: unknown; attr?: unknown };\n if (typeof obj.name === \"string\" && typeof obj.attr === \"string\") {\n out.push({ name: obj.name, attr: obj.attr });\n }\n }\n return out;\n}\n\nfunction collectImageOccurrences(\n root: MdNode,\n definitions: Map<string, string>,\n extraComponents: ComponentSpec[],\n): ImageOccurrence[] {\n const out: ImageOccurrence[] = [];\n visit(root, (node) => {\n if (node.type === \"image\") {\n const at = startOf(node);\n out.push({\n url: typeof node.url === \"string\" ? node.url : \"\",\n line: at.line,\n column: at.column,\n });\n return;\n }\n if (node.type === \"imageReference\") {\n const identifier =\n typeof node.identifier === \"string\" ? node.identifier : \"\";\n const url = definitions.get(identifier);\n if (!url) return;\n const at = startOf(node);\n out.push({ url, line: at.line, column: at.column });\n return;\n }\n if (\n node.type === \"mdxJsxFlowElement\" ||\n node.type === \"mdxJsxTextElement\"\n ) {\n if (node.name === \"img\") {\n const src = readJsxStringAttr(node, \"src\");\n if (src === null) return;\n const at = startOf(node);\n out.push({ url: src, line: at.line, column: at.column });\n return;\n }\n for (const spec of extraComponents) {\n if (node.name !== spec.name) continue;\n const src = readJsxStringAttr(node, spec.attr);\n if (src === null) return;\n const at = startOf(node);\n out.push({ url: src, line: at.line, column: at.column });\n return;\n }\n }\n });\n return out;\n}\n\nfunction collectDefinitions(root: MdNode): Map<string, string> {\n const out = new Map<string, string>();\n for (const def of collect(root, \"definition\")) {\n const id = typeof def.identifier === \"string\" ? def.identifier : \"\";\n const url = typeof def.url === \"string\" ? def.url : \"\";\n if (id && url && !out.has(id)) out.set(id, url);\n }\n return out;\n}\n\n/**\n * Read a string-valued JSX attribute. Returns null when the attribute is\n * absent, dynamic (expression form `<img src={x}>`), or boolean.\n * Static-only on purpose — dynamic srcs aren't checkable.\n */\nfunction readJsxStringAttr(node: MdNode, name: string): string | null {\n const attrs = (node as { attributes?: unknown }).attributes;\n if (!Array.isArray(attrs)) return null;\n for (const a of attrs) {\n if (!a || typeof a !== \"object\") continue;\n const attr = a as { name?: unknown; value?: unknown };\n if (attr.name !== name) continue;\n if (typeof attr.value === \"string\") return attr.value;\n return null;\n }\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// URL classification + resolution\n// ---------------------------------------------------------------------------\n\nfunction isExternal(url: string): boolean {\n return (\n /^[a-z][a-z0-9+.-]*:/i.test(url) || // any scheme: http:, data:, …\n url.startsWith(\"//\") // protocol-relative\n );\n}\n\n/** Strip query string and hash, then percent-decode. */\nfunction cleanUrl(url: string): string {\n let s = url;\n const q = s.indexOf(\"?\");\n if (q !== -1) s = s.slice(0, q);\n const h = s.indexOf(\"#\");\n if (h !== -1) s = s.slice(0, h);\n try {\n s = decodeURI(s);\n } catch {\n // Malformed encoding — leave as-is; the disk lookup will (correctly)\n // fail and surface a diagnostic the author can fix.\n }\n return s;\n}\n\nfunction readAliases(value: unknown): Array<[prefix: string, dir: string]> {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return [];\n const out: Array<[string, string]> = [];\n for (const [prefix, dir] of Object.entries(value as Record<string, unknown>)) {\n if (typeof dir === \"string\" && prefix.length > 0) out.push([prefix, dir]);\n }\n // Longest prefix wins when aliases nest (`~/assets/icons/` over `~/assets/`).\n out.sort((a, b) => b[0].length - a[0].length);\n return out;\n}\n\ninterface ResolvedRef {\n fullPath: string;\n /** Root-relative form for the diagnostic message. */\n display: string;\n}\n\nfunction resolveToDisk(\n url: string,\n root: string,\n fileAbsPath: string,\n aliases: Array<[string, string]>,\n): ResolvedRef | null {\n for (const [prefix, dir] of aliases) {\n if (url.startsWith(prefix)) {\n const rel = path.join(dir, url.slice(prefix.length));\n return { fullPath: path.join(root, rel), display: rel };\n }\n }\n if (url.startsWith(\"/\")) {\n const rel = path.join(\"public\", url.slice(1));\n return { fullPath: path.join(root, rel), display: rel };\n }\n if (url.startsWith(\"./\") || url.startsWith(\"../\")) {\n const fullPath = path.resolve(path.dirname(fileAbsPath), url);\n const rel = path.relative(root, fullPath);\n return { fullPath, display: rel.startsWith(\"..\") ? fullPath : rel };\n }\n return null;\n}\n\nfunction fileExists(fullPath: string): boolean {\n try {\n return fs.statSync(fullPath).isFile();\n } catch {\n return false;\n }\n}\n\n/**\n * Did-you-mean from the missing file's own directory — cheap (one\n * `readdir`) and covers the dominant failure (typo or wrong extension in\n * the filename, not the directory).\n */\nfunction suggestSibling(fullPath: string): string | null {\n let entries: string[];\n try {\n entries = fs.readdirSync(path.dirname(fullPath));\n } catch {\n return null;\n }\n return suggest(path.basename(fullPath), new Set(entries), 3);\n}\n\n/**\n * Minimal glob matcher — exact match or `prefix/**` suffix, same shape as\n * `internal-link`'s. Patterns are authored against the raw cleaned URL\n * (e.g. `/images/generated/**`).\n */\nfunction matchesAnyIgnore(url: string, patterns: string[]): boolean {\n if (patterns.length === 0) return false;\n for (const pat of patterns) {\n const stripped =\n pat.length > 1 && pat.endsWith(\"/\") ? pat.slice(0, -1) : pat;\n if (stripped.endsWith(\"/**\")) {\n const prefix = stripped.slice(0, -3);\n if (url === prefix || url.startsWith(`${prefix}/`)) return true;\n } else if (url === stripped) {\n return true;\n }\n }\n return false;\n}\n\n/** Find the project root from a content file by walking up to the parent of `src`. */\nfunction inferProjectRoot(absPath: string): string {\n const norm = absPath.replace(/\\\\/g, \"/\");\n const idx = norm.lastIndexOf(\"/src/\");\n return idx === -1 ? path.dirname(absPath) : norm.slice(0, idx);\n}\n","/**\n * nimbus/internal-link — internal links that don't resolve to a real\n * page on the site. Reads route truth from `.nimbus/routes.json`\n * materialized at integration time; without that file the rule skips\n * silently (every link would otherwise false-positive — the worst\n * outcome for a trust-sensitive rule).\n *\n * Coverage:\n * - `link` nodes (`[text](url)`)\n * - `linkReference` nodes (`[text][ref]` resolved against `definition`s)\n * - MDX JSX `<a href=\"...\">`\n * - Extra JSX components opt-in via `components: [{ name, attr }, …]` —\n * e.g. the starter's `<LinkCard href>`. The framework only ships the\n * `<a>` default because the starter's component names belong to the\n * user (rename, replace, delete at will); hardcoding them here would\n * couple the rule to a moving target.\n *\n * Resolution:\n * - External links (with a scheme) are skipped.\n * - In-page anchors (`#section`) are skipped (hash validation lives in\n * the future `nimbus/internal-link-hash` rule).\n * - The Astro `base` prefix is normalized away on both sides.\n * - Links under an opaque namespace (a non-framework dynamic route file)\n * stay silent — silence beats false-positive.\n * - When the framework root catch-all is present, content entries are\n * the truth for the root namespace.\n * - A near-match in the route set produces a \"did you mean\" hint via\n * Levenshtein distance — same pattern `component-pascalcase` uses.\n *\n * Relative links (`./foo`, `../bar`) error by default. `allowRelative: true`\n * silences them for projects that want to use them.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { suggest } from \"../../_internal/levenshtein.js\";\nimport {\n collect,\n startOf,\n visit,\n type MdNode,\n type ParsedFile,\n} from \"../parse.js\";\nimport type { Rule } from \"../rule.js\";\nimport type { RouteTruth } from \"../site-model.js\";\n\n// Process-level cache: read `routes.json` once per CLI invocation, not\n// once per file. The rule itself is stateless; the cache lives in the\n// module scope.\nlet cached: { root: string; truth: RouteTruth | null } | null = null;\nlet missingWarned = false;\n\nfunction loadRouteTruth(file: ParsedFile): RouteTruth | null {\n const root = inferProjectRoot(file.absPath);\n if (cached && cached.root === root) return cached.truth;\n\n let truth: RouteTruth | null = null;\n try {\n const raw = fs.readFileSync(\n path.join(root, \".nimbus\", \"routes.json\"),\n \"utf8\",\n );\n const parsed = JSON.parse(raw) as RouteTruth;\n if (parsed.version === 1) truth = parsed;\n } catch {\n if (!missingWarned) {\n process.stderr.write(\n \"nimbus/internal-link: skipped — `.nimbus/routes.json` is missing. Run `astro build` first; the route truth is materialized at `astro:build:done`.\\n\",\n );\n missingWarned = true;\n }\n }\n cached = { root, truth };\n return truth;\n}\n\n/** Find the project root from a content file by walking up to the parent of `src`. */\nfunction inferProjectRoot(absPath: string): string {\n // `/<root>/src/content/.../page.mdx` — strip from the *last* `/src/` so\n // a developer path that happens to contain `/src/` higher up (e.g.\n // `/Users/me/src/projects/my-docs/src/content/...`) infers `my-docs`,\n // not `/Users/me`.\n const norm = absPath.replace(/\\\\/g, \"/\");\n const idx = norm.lastIndexOf(\"/src/\");\n return idx === -1 ? path.dirname(absPath) : norm.slice(0, idx);\n}\n\n// ---------------------------------------------------------------------------\n\nexport const internalLink: Rule = {\n code: \"nimbus/internal-link\",\n run(ctx) {\n // Skip draft sources. Drafts are excluded from `routes.json` (the\n // framework filters them everywhere — content queries, sidebar,\n // version alternates), so a draft linking to another draft would\n // false-positive against the published route truth. Drafts are\n // in-flight; their links get rewritten before publishing anyway.\n // Published-page → draft links still go un-flagged, which is the\n // known trade-off vs. the route-tagged alternative.\n if (ctx.file.frontmatter?.draft === true) return;\n\n const truth = loadRouteTruth(ctx.file);\n if (!truth) return;\n\n const allowRelative = ctx.options.allowRelative === true;\n const ignore = Array.isArray(ctx.options.ignore)\n ? ctx.options.ignore.filter((s): s is string => typeof s === \"string\")\n : [];\n const extraComponents = readExtraComponents(ctx.options.components);\n\n // Route truth comes pre-resolved by Astro — see `astro:routes:resolved`\n // in `integration.ts`. We just compare against it.\n const knownRoutes = new Set<string>(truth.knownRoutes);\n const definitions = collectDefinitions(ctx.file.tree);\n\n for (const occ of collectLinkOccurrences(ctx.file.tree, definitions, extraComponents)) {\n const url = occ.url;\n if (!url) continue;\n if (isExternal(url)) continue;\n if (url.startsWith(\"#\")) continue; // in-page anchor\n\n if (isRelative(url)) {\n if (allowRelative) continue;\n ctx.report({\n message: `relative link \"${url}\" — internal docs links should be root-relative (e.g. /foo).`,\n line: occ.line,\n column: occ.column,\n });\n continue;\n }\n\n // Normalize first, then match `ignore` against the post-base form.\n // Authors write patterns relative to the site root (`/api/**`),\n // matching them against the raw URL would miss `/docs/api/foo` on a\n // site with `base: \"/docs\"` — the bug the original ordering had.\n const normalized = normalizeForLookup(url, truth.base);\n if (matchesAnyIgnore(normalized, ignore)) continue;\n if (isUnderOpaqueNamespace(normalized, truth.opaqueNamespaces)) continue;\n if (knownRoutes.has(normalized)) continue;\n\n const hint = suggest(normalized, knownRoutes, 3);\n ctx.report({\n message: hint\n ? `broken link \"${url}\" — did you mean \"${denormalize(hint, truth.base)}\"?`\n : `broken link \"${url}\" — no page resolves to this path.`,\n line: occ.line,\n column: occ.column,\n ...(hint\n ? {\n fix: {\n description: `replace \"${url}\" with \"${denormalize(hint, truth.base)}\"`,\n edits: [],\n },\n }\n : {}),\n });\n }\n },\n};\n\n// ---------------------------------------------------------------------------\n// AST traversal\n// ---------------------------------------------------------------------------\n\ninterface LinkOccurrence {\n url: string;\n line: number;\n column: number;\n}\n\ninterface ComponentSpec {\n name: string;\n attr: string;\n}\n\n/**\n * `<a href>` is always checked — plain anchors mean the same thing in\n * every MDX file. Extra components come from the `components` option.\n */\nfunction readExtraComponents(value: unknown): ComponentSpec[] {\n if (!Array.isArray(value)) return [];\n const out: ComponentSpec[] = [];\n for (const item of value) {\n if (!item || typeof item !== \"object\") continue;\n const obj = item as { name?: unknown; attr?: unknown };\n if (typeof obj.name === \"string\" && typeof obj.attr === \"string\") {\n out.push({ name: obj.name, attr: obj.attr });\n }\n }\n return out;\n}\n\n/**\n * Collect every internal-link candidate from the tree, normalized into one\n * shape so the rule's main loop doesn't fork on node type.\n */\nfunction collectLinkOccurrences(\n root: MdNode,\n definitions: Map<string, string>,\n extraComponents: ComponentSpec[],\n): LinkOccurrence[] {\n const out: LinkOccurrence[] = [];\n visit(root, (node) => {\n if (node.type === \"link\") {\n const at = startOf(node);\n out.push({\n url: typeof node.url === \"string\" ? node.url : \"\",\n line: at.line,\n column: at.column,\n });\n return;\n }\n if (node.type === \"linkReference\") {\n const identifier =\n typeof node.identifier === \"string\" ? node.identifier : \"\";\n const url = definitions.get(identifier);\n if (!url) return;\n const at = startOf(node);\n out.push({ url, line: at.line, column: at.column });\n return;\n }\n if (\n node.type === \"mdxJsxFlowElement\" ||\n node.type === \"mdxJsxTextElement\"\n ) {\n if (node.name === \"a\") {\n const href = readJsxStringAttr(node, \"href\");\n if (href === null) return;\n const at = startOf(node);\n out.push({ url: href, line: at.line, column: at.column });\n return;\n }\n for (const spec of extraComponents) {\n if (node.name !== spec.name) continue;\n const href = readJsxStringAttr(node, spec.attr);\n if (href === null) return;\n const at = startOf(node);\n out.push({ url: href, line: at.line, column: at.column });\n return;\n }\n }\n });\n return out;\n}\n\nfunction collectDefinitions(root: MdNode): Map<string, string> {\n const out = new Map<string, string>();\n for (const def of collect(root, \"definition\")) {\n const id = typeof def.identifier === \"string\" ? def.identifier : \"\";\n const url = typeof def.url === \"string\" ? def.url : \"\";\n if (id && url && !out.has(id)) out.set(id, url);\n }\n return out;\n}\n\n/**\n * Read a string-valued JSX attribute. Returns null when the attribute is\n * absent, dynamic (expression form `<a href={x}>`), or boolean (`<a\n * disabled>`). Static-only on purpose — dynamic hrefs aren't link-checkable.\n */\nfunction readJsxStringAttr(node: MdNode, name: string): string | null {\n const attrs = (node as { attributes?: unknown }).attributes;\n if (!Array.isArray(attrs)) return null;\n for (const a of attrs) {\n if (!a || typeof a !== \"object\") continue;\n const attr = a as { name?: unknown; value?: unknown };\n if (attr.name !== name) continue;\n if (typeof attr.value === \"string\") return attr.value;\n return null;\n }\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// URL classification + normalization\n// ---------------------------------------------------------------------------\n\nfunction isExternal(url: string): boolean {\n return (\n /^[a-z][a-z0-9+.-]*:/i.test(url) || // any scheme: http:, mailto:, tel:, …\n url.startsWith(\"//\") // protocol-relative\n );\n}\n\nfunction isRelative(url: string): boolean {\n return url.startsWith(\"./\") || url.startsWith(\"../\");\n}\n\n/**\n * Strip the Astro `base` prefix, any query string, any hash, and the\n * trailing slash, then percent-decode. Result is the canonical form used\n * in the route truth's `contentRoutes` and `pageRoutes` — Astro emits\n * routes with raw (decoded) segments, so an authored link like\n * `[x](/guides/setup%20notes)` must decode to match a route stored as\n * `/guides/setup notes`.\n */\nfunction normalizeForLookup(url: string, base: string): string {\n let s = url;\n const q = s.indexOf(\"?\");\n if (q !== -1) s = s.slice(0, q);\n const h = s.indexOf(\"#\");\n if (h !== -1) s = s.slice(0, h);\n\n const normBase = stripTrailingSlash(base === \"\" ? \"\" : base.startsWith(\"/\") ? base : `/${base}`);\n if (normBase !== \"\" && normBase !== \"/\" && s.startsWith(normBase + \"/\")) {\n s = s.slice(normBase.length);\n } else if (normBase !== \"\" && normBase !== \"/\" && s === normBase) {\n s = \"/\";\n }\n\n s = stripTrailingSlash(s);\n if (s === \"\") s = \"/\";\n try {\n s = decodeURI(s);\n } catch {\n // Malformed encoding — leave as-is so the lookup will (correctly) fail\n // and surface a broken-link diagnostic the author can fix.\n }\n return s;\n}\n\n/** Re-attach `base` for display in \"did you mean\" hints. */\nfunction denormalize(route: string, base: string): string {\n if (!base || base === \"/\" || base === \"\") return route;\n const normBase = base.startsWith(\"/\") ? stripTrailingSlash(base) : `/${stripTrailingSlash(base)}`;\n return route === \"/\" ? normBase : `${normBase}${route}`;\n}\n\nfunction stripTrailingSlash(s: string): string {\n return s.length > 1 && s.endsWith(\"/\") ? s.slice(0, -1) : s;\n}\n\nfunction isUnderOpaqueNamespace(\n route: string,\n opaqueNamespaces: string[],\n): boolean {\n for (const ns of opaqueNamespaces) {\n if (ns === \"/\") return true;\n if (route === ns) return true;\n if (route.startsWith(`${ns}/`)) return true;\n }\n return false;\n}\n\n/**\n * Minimal glob matcher — exact match or `prefix/**` suffix. Covers the\n * common `ignore` patterns (`/api/**`, `/changelog/**`) without pulling\n * in picomatch. Input is the post-`normalizeForLookup` URL (no `base`\n * prefix, no trailing slash, no hash/query), so patterns are authored\n * against the canonical site-root form.\n */\nfunction matchesAnyIgnore(normalizedUrl: string, patterns: string[]): boolean {\n if (patterns.length === 0) return false;\n for (const pat of patterns) {\n const stripped = stripTrailingSlash(pat);\n if (stripped.endsWith(\"/**\")) {\n const prefix = stripped.slice(0, -3);\n if (normalizedUrl === prefix || normalizedUrl.startsWith(`${prefix}/`)) {\n return true;\n }\n } else if (normalizedUrl === stripped) {\n return true;\n }\n }\n return false;\n}\n\n// Test-only export — clears the process-level cache. Real callers want one\n// load per CLI run; tests want isolation between cases.\nexport function _resetInternalLinkCacheForTests(): void {\n cached = null;\n missingWarned = false;\n}\n","/**\n * remark-lint rule to warn when unordered list markers are inconsistent.\n *\n * ## What is this?\n *\n * This package checks unordered list markers.\n *\n * ## When should I use this?\n *\n * You can use this package to check unordered lists.\n *\n * ## API\n *\n * ### `unified().use(remarkLintUnorderedListMarkerStyle[, options])`\n *\n * Warn when unordered list markers are inconsistent.\n *\n * ###### Parameters\n *\n * * `options` ([`Options`][api-options], default: `'consistent'`)\n * — preferred style or whether to detect the first style and warn for\n * further differences\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * ### `Options`\n *\n * Configuration (TypeScript type).\n *\n * ###### Type\n *\n * ```ts\n * type Options = Style | 'consistent'\n * ```\n *\n * ### `Style`\n *\n * Style (TypeScript type).\n *\n * ###### Type\n *\n * ```ts\n * type Style = '*' | '+' | '-'\n * ```\n *\n * ## Recommendation\n *\n * Because asterisks can be used as a marker for more markdown constructs,\n * it’s recommended to use that for lists (and thematic breaks, emphasis,\n * strong) too.\n *\n * ## Fix\n *\n * [`remark-stringify`][github-remark-stringify] formats unordered lists with\n * asterisks by default.\n * Pass `bullet: '+'` or `bullet: '-'` to use a different marker.\n *\n * [api-options]: #options\n * [api-style]: #style\n * [api-remark-lint-unordered-list-marker-style]: #unifieduseremarklintunorderedlistmarkerstyle-options\n * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify\n * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\n *\n * @module unordered-list-marker-style\n * @author Titus Wormer\n * @copyright Titus Wormer\n * @license MIT\n * @example\n * {\"name\": \"ok.md\"}\n *\n * * Mercury\n *\n * 1. Venus\n *\n * * Earth\n *\n * @example\n * {\"name\": \"ok.md\", \"config\": \"*\"}\n *\n * * Mercury\n *\n * @example\n * {\"name\": \"ok.md\", \"config\": \"-\"}\n *\n * - Mercury\n *\n * @example\n * {\"name\": \"ok.md\", \"config\": \"+\"}\n *\n * + Mercury\n *\n * @example\n * {\"name\": \"not-ok.md\", \"label\": \"input\"}\n *\n * * Mercury\n *\n * - Venus\n *\n * + Earth\n * @example\n * {\"name\": \"not-ok.md\", \"label\": \"output\"}\n *\n * 3:1: Unexpected unordered list marker `-`, expected `*`\n * 5:1: Unexpected unordered list marker `+`, expected `*`\n *\n * @example\n * {\"name\": \"not-ok.md\", \"label\": \"output\", \"config\": \"🌍\", \"positionless\": true}\n *\n * 1:1: Unexpected value `🌍` for `options`, expected `'*'`, `'+'`, `'-'`, or `'consistent'`\n */\n\n/**\n * @import {Root} from 'mdast'\n */\n\n/**\n * @typedef {Style | 'consistent'} Options\n * Configuration.\n *\n * @typedef {'*' | '+' | '-'} Style\n * Styles.\n */\n\nimport {phrasing} from 'mdast-util-phrasing'\nimport {lintRule} from 'unified-lint-rule'\nimport {pointStart} from 'unist-util-position'\nimport {SKIP, visitParents} from 'unist-util-visit-parents'\nimport {VFileMessage} from 'vfile-message'\n\nconst remarkLintUnorderedListMarkerStyle = lintRule(\n {\n origin: 'remark-lint:unordered-list-marker-style',\n url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-unordered-list-marker-style#readme'\n },\n /**\n * @param {Root} tree\n * Tree.\n * @param {Options | null | undefined} [options='consistent']\n * Configuration (default: `'consistent'`).\n * @returns {undefined}\n * Nothing.\n */\n function (tree, file, options) {\n const value = String(file)\n /** @type {Style | undefined} */\n let expected\n /** @type {VFileMessage | undefined} */\n let cause\n\n if (options === null || options === undefined || options === 'consistent') {\n // Empty.\n } else if (options === '*' || options === '+' || options === '-') {\n expected = options\n } else {\n file.fail(\n 'Unexpected value `' +\n options +\n \"` for `options`, expected `'*'`, `'+'`, `'-'`, or `'consistent'`\"\n )\n }\n\n visitParents(tree, function (node, parents) {\n // Do not walk into phrasing.\n if (phrasing(node)) {\n return SKIP\n }\n\n if (node.type !== 'listItem') return\n\n const parent = parents.at(-1)\n\n if (!parent || parent.type !== 'list' || parent.ordered) return\n\n const place = pointStart(node)\n\n if (!place || typeof place.offset !== 'number') return\n\n const code = value.charCodeAt(place.offset)\n\n const actual =\n code === 42 /* `*` */\n ? '*'\n : code === 43 /* `+` */\n ? '+'\n : code === 45 /* `-` */\n ? '-'\n : /* c8 ignore next -- weird ASTs. */\n undefined\n\n /* c8 ignore next -- weird ASTs. */\n if (!actual) return\n\n if (expected) {\n if (actual !== expected) {\n file.message(\n 'Unexpected unordered list marker `' +\n actual +\n '`, expected `' +\n expected +\n '`',\n {ancestors: [...parents, node], cause, place}\n )\n }\n } else {\n expected = actual\n cause = new VFileMessage(\n 'Unordered list marker style `' +\n expected +\n \"` first defined for `'consistent'` here\",\n {\n ancestors: [...parents, node],\n place,\n ruleId: 'unordered-list-marker-style',\n source: 'remark-lint'\n }\n )\n }\n })\n }\n)\n\nexport default remarkLintUnorderedListMarkerStyle\n","/**\n * nimbus/list-marker-style — consistent bullet marker across the docs.\n * `style?: \"dash\" | \"asterisk\"` (default `dash`). Auto-fixable: swap the\n * marker character on the offending list item.\n *\n * Detection is delegated to `remark-lint-unordered-list-marker-style`\n * via the adapter (configured with the chosen marker). The wrapper\n * re-walks the tree at each reported position to recover the listItem\n * offset for the surgical fix.\n */\n\nimport remarkLintUnorderedListMarkerStyle from \"remark-lint-unordered-list-marker-style\";\n\nimport { findNodeAt } from \"../parse.js\";\nimport { runRemarkLintRule } from \"../remark-lint-adapter.js\";\nimport type { Rule } from \"../rule.js\";\n\nconst MARKER = { dash: \"-\", asterisk: \"*\" } as const;\n\nexport const listMarkerStyle: Rule = {\n code: \"nimbus/list-marker-style\",\n run(ctx) {\n const style = ctx.options.style === \"asterisk\" ? \"asterisk\" : \"dash\";\n const want = MARKER[style];\n\n const reports = runRemarkLintRule(\n remarkLintUnorderedListMarkerStyle,\n ctx.file.tree,\n {\n path: ctx.file.path,\n source: ctx.file.source,\n settings: [want],\n },\n );\n\n for (const r of reports) {\n const item = findNodeAt(ctx.file.tree, \"listItem\", r.line, r.column);\n const offset = item?.position?.start.offset;\n if (typeof offset !== \"number\") {\n ctx.report({\n ...r,\n message: `bullet marker should be \"${want}\".`,\n });\n continue;\n }\n const ch = ctx.file.source[offset];\n if (ch !== \"-\" && ch !== \"*\" && ch !== \"+\") {\n // Defensive: the offset doesn't land on a real marker character.\n ctx.report({\n ...r,\n message: `bullet marker should be \"${want}\".`,\n });\n continue;\n }\n\n ctx.report({\n ...r,\n message: `bullet uses \"${ch}\" — this project's list marker is \"${want}\".`,\n fix: {\n description: `change \"${ch}\" to \"${want}\"`,\n edits: [{ range: [offset, offset + 1], text: want }],\n },\n });\n }\n },\n};\n","/**\n * nimbus/no-self-host-url — same-site links should be root-relative\n * (`/page`), not absolute URLs at the site's own host. Absolute self-host\n * links break across environments (preview vs production) and skip the\n * router.\n *\n * The project's `site` URL (from `nimbusConfig.site`, threaded through\n * `ctx.site`) is always banned — the rule infers the deploy host\n * automatically so authors don't have to duplicate it in their lint\n * config. Localhost/loopback hosts are always banned too. Additional\n * hosts go in `hosts?: string[]` (e.g. legacy domains, www subdomains\n * that don't redirect, or staging hostnames).\n */\n\nimport { collect, startOf } from \"../parse.js\";\nimport type { Rule } from \"../rule.js\";\n\nconst ALWAYS_BANNED = [\"localhost\", \"127.0.0.1\", \"0.0.0.0\"];\n\nexport const noSelfHostUrl: Rule = {\n code: \"nimbus/no-self-host-url\",\n run(ctx) {\n const configured = Array.isArray(ctx.options.hosts)\n ? ctx.options.hosts.filter((h): h is string => typeof h === \"string\")\n : [];\n const siteHost = hostnameOf(ctx.site);\n const banned = [\n ...ALWAYS_BANNED,\n ...(siteHost ? [siteHost] : []),\n ...configured,\n ];\n\n for (const link of collect(ctx.file.tree, \"link\")) {\n const url = typeof link.url === \"string\" ? link.url : \"\";\n let hostname: string;\n try {\n hostname = new URL(url).hostname;\n } catch {\n continue; // relative or non-URL — fine\n }\n const hit = banned.some(\n (b) => hostname === b || hostname.endsWith(`.${b}`),\n );\n if (!hit) continue;\n\n const at = startOf(link);\n ctx.report({\n message: `link points at self-host \"${hostname}\" — use a root-relative path (e.g. /page) for same-site links.`,\n line: at.line,\n column: at.column,\n });\n }\n },\n};\n\n/** Extract a bare hostname from a `site`-shaped value, or null if not parseable. */\nfunction hostnameOf(site: string | undefined): string | null {\n if (!site) return null;\n try {\n return new URL(site).hostname;\n } catch {\n return null;\n }\n}\n","/**\n * remark-lint rule to warn when top-level headings are used multiple times.\n *\n * ## What is this?\n *\n * This package checks that top-level headings are unique.\n *\n * ## When should I use this?\n *\n * You can use this package to check heading structure.\n *\n * ## API\n *\n * ### `unified().use(remarkLintNoMultipleToplevelHeadings[, options])`\n *\n * Warn when top-level headings are used multiple times.\n *\n * ###### Parameters\n *\n * * `options` ([`Options`][api-options], default: `1`)\n * — configuration\n *\n * ###### Returns\n *\n * Transform ([`Transformer` from `unified`][github-unified-transformer]).\n *\n * ### `Depth`\n *\n * Depth (TypeScript type).\n *\n * ###### Type\n *\n * ```ts\n * type Depth = 1 | 2 | 3 | 4 | 5 | 6\n * ```\n *\n * ### `Options`\n *\n * Configuration (TypeScript type).\n *\n * ###### Type\n *\n * ```ts\n * type Options = Depth\n * ```\n *\n * ## Recommendation\n *\n * Documents should almost always have one main heading,\n * which is typically a heading with a rank of `1`.\n *\n * [api-depth]: #depth\n * [api-options]: #options\n * [api-remark-lint-no-multiple-toplevel-headings]: #unifieduseremarklintnomultipletoplevelheadings-options\n * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify\n * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer\n *\n * @module no-multiple-toplevel-headings\n * @author Titus Wormer\n * @copyright Titus Wormer\n * @license MIT\n *\n * @example\n * {\"name\": \"ok.md\"}\n *\n * # Mercury\n *\n * ## Venus\n *\n * @example\n * {\"label\": \"input\", \"name\": \"not-ok.md\"}\n *\n * # Venus\n *\n * # Mercury\n * @example\n * {\"label\": \"output\", \"name\": \"not-ok.md\"}\n *\n * 3:1-3:10: Unexpected duplicate toplevel heading, exected a single heading with rank `1`\n *\n * @example\n * {\"config\": 2, \"label\": \"input\", \"name\": \"not-ok.md\"}\n *\n * ## Venus\n *\n * ## Mercury\n * @example\n * {\"config\": 2, \"label\": \"output\", \"name\": \"not-ok.md\"}\n *\n * 3:1-3:11: Unexpected duplicate toplevel heading, exected a single heading with rank `2`\n *\n * @example\n * {\"label\": \"input\", \"name\": \"html.md\"}\n *\n * Venus <b>and</b> mercury.\n *\n * <h1>Earth</h1>\n *\n * <h1>Mars</h1>\n * @example\n * {\"label\": \"output\", \"name\": \"html.md\"}\n *\n * 5:1-5:14: Unexpected duplicate toplevel heading, exected a single heading with rank `1`\n *\n * @example\n * {\"label\": \"input\", \"mdx\": true, \"name\": \"mdx.mdx\"}\n *\n * Venus <b>and</b> mercury.\n *\n * <h1>Earth</h1>\n * <h1>Mars</h1>\n * @example\n * {\"label\": \"output\", \"mdx\": true, \"name\": \"mdx.mdx\"}\n *\n * 4:1-4:14: Unexpected duplicate toplevel heading, exected a single heading with rank `1`\n */\n\n/**\n * @import {Heading, Nodes, Root} from 'mdast'\n * @import {} from 'mdast-util-mdx'\n */\n\n/**\n * @typedef {Heading['depth']} Depth\n * Styles.\n *\n * @typedef {Depth} Options\n * Configuration.\n */\n\nimport {ok as assert} from 'devlop'\nimport {lintRule} from 'unified-lint-rule'\nimport {visitParents} from 'unist-util-visit-parents'\nimport {VFileMessage} from 'vfile-message'\n\nconst htmlRe = /<h([1-6])/\nconst jsxNameRe = /^h([1-6])$/\n\nconst remarkLintNoMultipleToplevelHeadings = lintRule(\n {\n origin: 'remark-lint:no-multiple-toplevel-headings',\n url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-multiple-toplevel-headings#readme'\n },\n /**\n * @param {Root} tree\n * Tree.\n * @param {Options | null | undefined} [options=1]\n * Configuration (default: `1`).\n * @returns {undefined}\n * Nothing.\n */\n function (tree, file, options) {\n const option = options || 1\n /** @type {Array<Nodes> | undefined} */\n let duplicateAncestors\n\n visitParents(tree, function (node, parents) {\n /** @type {Depth | undefined} */\n let rank\n\n if (node.type === 'heading') {\n rank = node.depth\n } else if (node.type === 'html') {\n const results = node.value.match(htmlRe)\n rank = results ? /** @type {Depth} */ (Number(results[1])) : undefined\n } else if (\n (node.type === 'mdxJsxFlowElement' ||\n node.type === 'mdxJsxTextElement') &&\n node.name\n ) {\n const results = node.name.match(jsxNameRe)\n rank = results ? /** @type {Depth} */ (Number(results[1])) : undefined\n }\n\n if (rank) {\n const ancestors = [...parents, node]\n\n if (node.position && rank === option) {\n if (duplicateAncestors) {\n const duplicate = duplicateAncestors.at(-1)\n assert(duplicate) // Always defined.\n\n file.message(\n 'Unexpected duplicate toplevel heading, exected a single heading with rank `' +\n rank +\n '`',\n {\n ancestors,\n cause: new VFileMessage(\n 'Toplevel heading already defined here',\n {\n ancestors: duplicateAncestors,\n place: duplicate.position,\n source: 'remark-lint',\n ruleId: 'no-multiple-toplevel-headings'\n }\n ),\n place: node.position\n }\n )\n } else {\n duplicateAncestors = ancestors\n }\n }\n }\n })\n }\n)\n\nexport default remarkLintNoMultipleToplevelHeadings\n","/**\n * nimbus/single-h1 — a page should have at most one top-level (`#`)\n * heading. Reports every H1 after the first. Zero H1s is fine: many\n * layouts render the page title from frontmatter, so the body legitimately\n * starts at H2.\n *\n * Detection is delegated to `remark-lint-no-multiple-toplevel-headings`\n * via the remark-lint adapter — Sätteri-parsed tree, remark-lint detector\n * logic, our message + envelope. The message stays Nimbus-shaped so the\n * agent-loop hint (\"demote to ##\") is preserved.\n */\n\nimport remarkLintNoMultipleTopLevelHeadings from \"remark-lint-no-multiple-toplevel-headings\";\n\nimport { runRemarkLintRule } from \"../remark-lint-adapter.js\";\nimport type { Rule } from \"../rule.js\";\n\nexport const singleH1: Rule = {\n code: \"nimbus/single-h1\",\n run(ctx) {\n const reports = runRemarkLintRule(\n remarkLintNoMultipleTopLevelHeadings,\n ctx.file.tree,\n { path: ctx.file.path, source: ctx.file.source },\n );\n for (const r of reports) {\n ctx.report({\n ...r,\n message:\n 'more than one top-level \"#\" heading — a page should have a single H1. Demote this to \"##\" or fold it into the page above.',\n });\n }\n },\n};\n","/**\n * The rule registry. Authoring rules implemented so far span the content\n * shape (Phase 1–2), markdown formatting (Phase 3), and route awareness\n * (Phase 3 `internal-link`). The remaining sidebar-aware rules\n * (`orphan-page`, `sidebar-entry`) and build validators land in later\n * increments.\n */\n\nimport type { RuleCode } from \"../diagnostic.js\";\nimport type { Rule } from \"../rule.js\";\nimport { bareUrl } from \"./bare-url.js\";\nimport { codeBlockLang } from \"./code-block-lang.js\";\nimport { codeBlockPromptPrefix } from \"./code-block-prompt-prefix.js\";\nimport { descriptionRequired } from \"./description-required.js\";\nimport { duplicateHeadingText } from \"./duplicate-heading-text.js\";\nimport { emphasisStyle } from \"./emphasis-style.js\";\nimport { frontmatterShape } from \"./frontmatter-shape.js\";\nimport { headingHierarchy } from \"./heading-hierarchy.js\";\nimport { headingPunctuation } from \"./heading-punctuation.js\";\nimport { imageRef } from \"./image-ref.js\";\nimport { internalLink } from \"./internal-link.js\";\nimport { listMarkerStyle } from \"./list-marker-style.js\";\nimport { noSelfHostUrl } from \"./no-self-host-url.js\";\nimport { singleH1 } from \"./single-h1.js\";\n\nexport const RULES: Rule[] = [\n // Content shape\n frontmatterShape,\n descriptionRequired,\n singleH1,\n headingHierarchy,\n codeBlockLang,\n codeBlockPromptPrefix,\n noSelfHostUrl,\n // Markdown formatting\n headingPunctuation,\n duplicateHeadingText,\n listMarkerStyle,\n emphasisStyle,\n bareUrl,\n // Route-aware\n internalLink,\n imageRef,\n];\n\n/** Codes with a wired implementation (a subset of `RULE_CODES`). */\nexport const IMPLEMENTED_CODES: ReadonlySet<RuleCode> = new Set(\n RULES.map((r) => r.code),\n);\n"],"x_google_ignoreList":[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,23,24,25,30,32,36,38,43,46],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,aAAa;CAExB,qBAAqB,EAAE,MAAM,SAAS;CACtC,+BAA+B,EAAE,MAAM,SAAS;CAChD,yBAAyB,EAAE,MAAM,SAAS;CAC1C,yBAAyB,EAAE,MAAM,SAAS;CAG1C,4BAA4B,EAAE,MAAM,aAAa;CACjD,+BAA+B,EAAE,MAAM,aAAa;CACpD,wBAAwB,EAAE,MAAM,aAAa;CAC7C,oBAAoB,EAAE,MAAM,aAAa;CACzC,sBAAsB,EAAE,MAAM,aAAa;CAC3C,wBAAwB,EAAE,MAAM,aAAa;CAC7C,oBAAoB,EAAE,MAAM,aAAa;CACzC,4BAA4B,EAAE,MAAM,aAAa;CACjD,0BAA0B,EAAE,MAAM,aAAa;CAC/C,mCAAmC,EAAE,MAAM,aAAa;CACxD,2BAA2B,EAAE,MAAM,aAAa;CAChD,8BAA8B,EAAE,MAAM,aAAa;CACnD,iCAAiC,EAAE,MAAM,aAAa;CACtD,4BAA4B,EAAE,MAAM,aAAa;CACjD,yBAAyB,EAAE,MAAM,aAAa;CAC9C,mBAAmB,EAAE,MAAM,aAAa;CACzC;;AAsDD,SAAgB,iBAAiB,MAAyB;AACxD,QAAO,WAAW,MAAM,SAAS;;;AAInC,SAAgB,qBAAiC;AAC/C,QAAQ,OAAO,KAAK,WAAW,CAAgB,QAC5C,MAAM,WAAW,GAAG,S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