Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions scripts/parsers/directives/reference-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
// node.label is non-empty. Directives that need a computed display label mutate
// node.label in their expand hook; render() then omits `label` from output.params.

import { createRequire } from 'module';
import type { DirectiveDef, DirectiveRenderOutput } from '../directive-registry.js';
import { DirectiveParseError } from '../directives.js';
import type { DirectiveNode, ExpandDirectivesContext } from '../directives.js';

// Load api-libs.json at module init time
const _require = createRequire(import.meta.url);
const API_LIBS: Record<string, string> = _require('./api-libs.json');
// Static default import so esbuild inlines the JSON into the parsers bundle.
// A runtime require left it external of parsers.bundle.mjs (same class of bug
// that crashed tutorials-srv-qa for icon-allowlist.json). resolveJsonModule is on.
import API_LIBS from './api-libs.json';

// ─── :tutorial-ref[slug]{label?} ─────────────────────────────────────────────
//
Expand Down
9 changes: 4 additions & 5 deletions scripts/parsers/directives/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
// Side-effect: call registerUiDirectives() once at startup.
// In tests: resetRegistry(); registerUiDirectives()

import { createRequire } from 'node:module';
import { registerDirective, getRegistry } from '../directive-registry.js';
import { DirectiveParseError } from '../directives.js';
import type { DirectiveNode } from '../directives.js';

const _require = createRequire(import.meta.url);
// eslint-disable-next-line @typescript-eslint/no-var-requires
const iconAllowlist: string[] = _require('./icon-allowlist.json') as string[];
// Static default import so esbuild inlines the JSON into the parsers bundle
// (parsers.bundle.mjs). A runtime require left it external and crashed
// tutorials-srv-qa at boot with MODULE_NOT_FOUND. resolveJsonModule is on.
import iconAllowlist from './icon-allowlist.json';

// ─── Key token constants ──────────────────────────────────────────────────────

Expand Down
Loading