@immediately-run/sdk 0.50.0 → 0.52.0

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.
Files changed (77) hide show
  1. package/dist/analytics.cjs +47 -0
  2. package/dist/analytics.cjs.map +1 -0
  3. package/dist/analytics.d.cts +46 -0
  4. package/dist/analytics.d.ts +46 -0
  5. package/dist/analytics.js +21 -0
  6. package/dist/analytics.js.map +1 -0
  7. package/dist/corpus.cjs +91 -0
  8. package/dist/corpus.cjs.map +1 -0
  9. package/dist/corpus.d.cts +63 -0
  10. package/dist/corpus.d.ts +63 -0
  11. package/dist/corpus.js +62 -0
  12. package/dist/corpus.js.map +1 -0
  13. package/dist/generated/protocol.d.cts +1 -0
  14. package/dist/generated/protocol.d.ts +1 -0
  15. package/dist/index.cjs +4 -0
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +5 -6
  18. package/dist/index.d.ts +5 -6
  19. package/dist/index.js +2 -0
  20. package/dist/index.js.map +1 -1
  21. package/dist/linkSpace.cjs +4 -36
  22. package/dist/linkSpace.cjs.map +1 -1
  23. package/dist/linkSpace.d.cts +3 -60
  24. package/dist/linkSpace.d.ts +3 -60
  25. package/dist/linkSpace.js +1 -33
  26. package/dist/linkSpace.js.map +1 -1
  27. package/dist/protocolSchemes.cjs +1 -0
  28. package/dist/protocolSchemes.cjs.map +1 -1
  29. package/dist/protocolSchemes.d.cts +1 -0
  30. package/dist/protocolSchemes.d.ts +1 -0
  31. package/dist/protocolSchemes.js +2 -0
  32. package/dist/protocolSchemes.js.map +1 -1
  33. package/dist/safeContent/SafeContent.cjs +2 -27
  34. package/dist/safeContent/SafeContent.cjs.map +1 -1
  35. package/dist/safeContent/SafeContent.d.cts +1 -13
  36. package/dist/safeContent/SafeContent.d.ts +1 -13
  37. package/dist/safeContent/SafeContent.js +1 -26
  38. package/dist/safeContent/SafeContent.js.map +1 -1
  39. package/dist/safeContent/index.cjs +3 -23
  40. package/dist/safeContent/index.cjs.map +1 -1
  41. package/dist/safeContent/index.d.cts +1 -6
  42. package/dist/safeContent/index.d.ts +1 -6
  43. package/dist/safeContent/index.js +1 -14
  44. package/dist/safeContent/index.js.map +1 -1
  45. package/dist/safeContent/mdastDeps.cjs +7 -2
  46. package/dist/safeContent/mdastDeps.js +7 -2
  47. package/dist/safeContent/parseSafeMdast.cjs +2 -53
  48. package/dist/safeContent/parseSafeMdast.cjs.map +1 -1
  49. package/dist/safeContent/parseSafeMdast.d.cts +1 -45
  50. package/dist/safeContent/parseSafeMdast.d.ts +1 -45
  51. package/dist/safeContent/parseSafeMdast.js +1 -42
  52. package/dist/safeContent/parseSafeMdast.js.map +1 -1
  53. package/dist/safeContent/renderMdast.cjs +2 -133
  54. package/dist/safeContent/renderMdast.cjs.map +1 -1
  55. package/dist/safeContent/renderMdast.d.cts +1 -27
  56. package/dist/safeContent/renderMdast.d.ts +1 -27
  57. package/dist/safeContent/renderMdast.js +1 -132
  58. package/dist/safeContent/renderMdast.js.map +1 -1
  59. package/dist/safeContent/sanitizeUrl.cjs +2 -12
  60. package/dist/safeContent/sanitizeUrl.cjs.map +1 -1
  61. package/dist/safeContent/sanitizeUrl.d.cts +1 -9
  62. package/dist/safeContent/sanitizeUrl.d.ts +1 -9
  63. package/dist/safeContent/sanitizeUrl.js +1 -11
  64. package/dist/safeContent/sanitizeUrl.js.map +1 -1
  65. package/dist/safeContent/wikilink.cjs +3 -35
  66. package/dist/safeContent/wikilink.cjs.map +1 -1
  67. package/dist/safeContent/wikilink.d.cts +1 -21
  68. package/dist/safeContent/wikilink.d.ts +1 -21
  69. package/dist/safeContent/wikilink.js +1 -33
  70. package/dist/safeContent/wikilink.js.map +1 -1
  71. package/dist/version.cjs +1 -1
  72. package/dist/version.cjs.map +1 -1
  73. package/dist/version.d.cts +1 -1
  74. package/dist/version.d.ts +1 -1
  75. package/dist/version.js +1 -1
  76. package/dist/version.js.map +1 -1
  77. package/package.json +7 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/safeContent/SafeContent.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react';\nimport { parseSafeMdast } from './parseSafeMdast';\nimport { renderMdast, type RenderMdastOptions } from './renderMdast';\n\n// R3-213 — sharing the component map: `parseSafeMdast` runs the SAME kernel remark\n// plugins the compiled path uses, so it emits `<Admonition>` / `<WikiLink>` /\n// `<HeadingAnchor>` element nodes. To render them identically to the compiled path (and\n// so pick up the R3-212 fragment resolver + scroll), an interpreter app passes the SAME\n// `DEFAULT_MDX_COMPONENTS` it hands `boot({ mdxComponents })` as this component's\n// `components` — that shared map IS the uniformity (no forked second component set). We\n// deliberately do NOT import DEFAULT_MDX_COMPONENTS here: the safe renderer is a lean,\n// dep-light security primitive (render-as-data, no evaluator, ESM-clean for the e2e\n// bundle), and must not pull the full component library into its module graph.\n\n// `<SafeContent>` — the host/SDK-owned safe renderer (TRUST_MODES_SPEC §5.1,\n// AGENT_AUTHORING §10). An interpreter app renders untrusted Markdown/MDX-syntax\n// content — a shared board's body, a multi-writer wiki entry — through THIS component\n// so **no author JavaScript ever executes** while `<Component/>` syntax still reaches\n// the app's own safe components. It is the mandatory terminal for the MDX-from-mount\n// gate: a shared board is a multi-writer (M3) source, and compiled/executable MDX\n// would run board-author code with the app's authority (the WHITEBOARD §8 blast\n// radius this gate bounds).\n//\n// The parse (no-acorn, ESM-only deps) is async, so this renders a small placeholder\n// until the tree is ready, then the pure synchronous `renderMdast`. Parsing is keyed\n// on the source string; a changed source re-parses, and a stale async result is\n// discarded (the ref guard) so a fast source swap can't paint the wrong content.\n\nexport interface SafeContentProps extends RenderMdastOptions {\n /** The untrusted Markdown/MDX-syntax source to render as data. */\n source: string;\n /** Rendered while the async parse is in flight (default: nothing). */\n fallback?: ReactNode;\n}\n\nexport function SafeContent({ source, fallback = null, ...options }: SafeContentProps): ReactNode {\n const [tree, setTree] = useState<Awaited<ReturnType<typeof parseSafeMdast>> | null>(null);\n const runId = useRef(0);\n\n useEffect(() => {\n const id = ++runId.current;\n setTree(null);\n let cancelled = false;\n parseSafeMdast(source)\n .then((parsed) => {\n // Discard a stale result (source changed / unmounted) so we never paint the\n // wrong tree — the render-as-data guarantee also needs the RIGHT data shown.\n if (!cancelled && runId.current === id) setTree(parsed);\n })\n .catch(() => {\n if (!cancelled && runId.current === id) setTree(null);\n });\n return () => {\n cancelled = true;\n };\n }, [source]);\n\n // `renderMdast` is pure; memoise on the tree + the option identities the caller\n // passes. (Callers should memoise `components`/`resolveWikiLink` themselves for a\n // stable identity; changing them re-renders, which is correct.)\n const rendered = useMemo(\n () => (tree ? renderMdast(tree, options) : null),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [tree, options.components, options.resolveWikiLink],\n );\n\n return tree ? rendered : fallback;\n}\n"],"mappings":";AAAA,SAAS,WAAW,SAAS,QAAQ,gBAAgC;AACrE,SAAS,sBAAsB;AAC/B,SAAS,mBAA4C;AAiC9C,SAAS,YAAY,EAAE,QAAQ,WAAW,MAAM,GAAG,QAAQ,GAAgC;AAChG,QAAM,CAAC,MAAM,OAAO,IAAI,SAA4D,IAAI;AACxF,QAAM,QAAQ,OAAO,CAAC;AAEtB,YAAU,MAAM;AACd,UAAM,KAAK,EAAE,MAAM;AACnB,YAAQ,IAAI;AACZ,QAAI,YAAY;AAChB,mBAAe,MAAM,EAClB,KAAK,CAAC,WAAW;AAGhB,UAAI,CAAC,aAAa,MAAM,YAAY,GAAI,SAAQ,MAAM;AAAA,IACxD,CAAC,EACA,MAAM,MAAM;AACX,UAAI,CAAC,aAAa,MAAM,YAAY,GAAI,SAAQ,IAAI;AAAA,IACtD,CAAC;AACH,WAAO,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAKX,QAAM,WAAW;AAAA,IACf,MAAO,OAAO,YAAY,MAAM,OAAO,IAAI;AAAA;AAAA,IAE3C,CAAC,MAAM,QAAQ,YAAY,QAAQ,eAAe;AAAA,EACpD;AAEA,SAAO,OAAO,WAAW;AAC3B;","names":[]}
1
+ {"version":3,"sources":["../../src/safeContent/SafeContent.tsx"],"sourcesContent":["// R3-279 (phase 3): re-export shim — the implementation lives in\n// `@immediately-run/safe-content`; this subpath keeps working byte-compatibly.\nexport { SafeContent } from '@immediately-run/safe-content';\nexport type { SafeContentProps } from '@immediately-run/safe-content';\n"],"mappings":";AAEA,SAAS,mBAAmB;","names":[]}
@@ -3,10 +3,6 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
6
  var __copyProps = (to, from, except, desc) => {
11
7
  if (from && typeof from === "object" || typeof from === "function") {
12
8
  for (let key of __getOwnPropNames(from))
@@ -15,29 +11,13 @@ var __copyProps = (to, from, except, desc) => {
15
11
  }
16
12
  return to;
17
13
  };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
16
  var safeContent_exports = {};
20
- __export(safeContent_exports, {
21
- SafeContent: () => import_SafeContent.SafeContent,
22
- parseSafeMdast: () => import_parseSafeMdast.parseSafeMdast,
23
- parseWikiInner: () => import_wikilink.parseWikiInner,
24
- renderMdast: () => import_renderMdast.renderMdast,
25
- sanitizeUrl: () => import_sanitizeUrl.sanitizeUrl,
26
- splitWikiLinks: () => import_wikilink.splitWikiLinks
27
- });
28
17
  module.exports = __toCommonJS(safeContent_exports);
29
- var import_SafeContent = require("./SafeContent");
30
- var import_renderMdast = require("./renderMdast");
31
- var import_parseSafeMdast = require("./parseSafeMdast");
32
- var import_sanitizeUrl = require("./sanitizeUrl");
33
- var import_wikilink = require("./wikilink");
18
+ __reExport(safeContent_exports, require("@immediately-run/safe-content"), module.exports);
34
19
  // Annotate the CommonJS export names for ESM import in node:
35
20
  0 && (module.exports = {
36
- SafeContent,
37
- parseSafeMdast,
38
- parseWikiInner,
39
- renderMdast,
40
- sanitizeUrl,
41
- splitWikiLinks
21
+ ...require("@immediately-run/safe-content")
42
22
  });
43
23
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/safeContent/index.ts"],"sourcesContent":["// Safe content rendering — non-executable MDX (TRUST_MODES_SPEC §5.1, AGENT_AUTHORING\n// §10). The host/SDK-owned renderer an INTERPRETER app uses to render untrusted\n// Markdown/MDX-syntax content as data, with **no evaluator anywhere in the pipeline**.\n// This is the mandatory terminal for the MDX-from-mount gate (§10 delta 1) — a shared\n// (multi-writer / M3) board or wiki entry MUST render through here, never compiled MDX.\n//\n// It is a **T2 tool, not a platform gate**: it stops content executing as code; it does\n// not certify anything to the host, and CO-4 data-fencing is still required for anything\n// that *reads* the content (the agent case).\n\nexport { SafeContent } from './SafeContent';\nexport type { SafeContentProps } from './SafeContent';\nexport { renderMdast } from './renderMdast';\nexport type { RenderMdastOptions, SafeContentComponents } from './renderMdast';\nexport { parseSafeMdast } from './parseSafeMdast';\nexport type { SafeMdastNode, SafeMdxAttribute, ParseSafeMdastOptions } from './parseSafeMdast';\nexport { sanitizeUrl } from './sanitizeUrl';\nexport { splitWikiLinks, parseWikiInner } from './wikilink';\nexport type { WikiLinkToken, WikiPart } from './wikilink';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,yBAA4B;AAE5B,yBAA4B;AAE5B,4BAA+B;AAE/B,yBAA4B;AAC5B,sBAA+C;","names":[]}
1
+ {"version":3,"sources":["../../src/safeContent/index.ts"],"sourcesContent":["// Safe content rendering — non-executable MDX (TRUST_MODES_SPEC §5.1, AGENT_AUTHORING\n// §10). The host/SDK-owned renderer an INTERPRETER app uses to render untrusted\n// Markdown/MDX-syntax content as data, with **no evaluator anywhere in the pipeline**.\n// This is the mandatory terminal for the MDX-from-mount gate (§10 delta 1) — a shared\n// (multi-writer / M3) board or wiki entry MUST render through here, never compiled MDX.\n//\n// It is a **T2 tool, not a platform gate**: it stops content executing as code; it does\n// not certify anything to the host, and CO-4 data-fencing is still required for anything\n// that *reads* the content (the agent case).\n//\n// R3-279 (phase 3): the implementation now lives in `@immediately-run/safe-content`\n// (the S3 content-framework tier's first extraction). This module — and every sibling\n// subpath below — is a byte-compat RE-EXPORT: `api-snapshot.json` is unchanged, every\n// existing `@immediately-run/sdk/safeContent/*` import keeps working, and no consumer\n// changes anywhere.\nexport * from '@immediately-run/safe-content';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAeA,gCAAc,0CAfd;","names":[]}
@@ -1,6 +1 @@
1
- export { SafeContent, SafeContentProps } from './SafeContent.cjs';
2
- export { RenderMdastOptions, SafeContentComponents, renderMdast } from './renderMdast.cjs';
3
- export { ParseSafeMdastOptions, SafeMdastNode, SafeMdxAttribute, parseSafeMdast } from './parseSafeMdast.cjs';
4
- export { sanitizeUrl } from './sanitizeUrl.cjs';
5
- export { WikiLinkToken, WikiPart, parseWikiInner, splitWikiLinks } from './wikilink.cjs';
6
- import 'react';
1
+ export * from '@immediately-run/safe-content';
@@ -1,6 +1 @@
1
- export { SafeContent, SafeContentProps } from './SafeContent.js';
2
- export { RenderMdastOptions, SafeContentComponents, renderMdast } from './renderMdast.js';
3
- export { ParseSafeMdastOptions, SafeMdastNode, SafeMdxAttribute, parseSafeMdast } from './parseSafeMdast.js';
4
- export { sanitizeUrl } from './sanitizeUrl.js';
5
- export { WikiLinkToken, WikiPart, parseWikiInner, splitWikiLinks } from './wikilink.js';
6
- import 'react';
1
+ export * from '@immediately-run/safe-content';
@@ -1,15 +1,2 @@
1
- import "../chunk-VHAA22YE.js";
2
- import { SafeContent } from "./SafeContent";
3
- import { renderMdast } from "./renderMdast";
4
- import { parseSafeMdast } from "./parseSafeMdast";
5
- import { sanitizeUrl } from "./sanitizeUrl";
6
- import { splitWikiLinks, parseWikiInner } from "./wikilink";
7
- export {
8
- SafeContent,
9
- parseSafeMdast,
10
- parseWikiInner,
11
- renderMdast,
12
- sanitizeUrl,
13
- splitWikiLinks
14
- };
1
+ export * from "@immediately-run/safe-content";
15
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/safeContent/index.ts"],"sourcesContent":["// Safe content rendering — non-executable MDX (TRUST_MODES_SPEC §5.1, AGENT_AUTHORING\n// §10). The host/SDK-owned renderer an INTERPRETER app uses to render untrusted\n// Markdown/MDX-syntax content as data, with **no evaluator anywhere in the pipeline**.\n// This is the mandatory terminal for the MDX-from-mount gate (§10 delta 1) — a shared\n// (multi-writer / M3) board or wiki entry MUST render through here, never compiled MDX.\n//\n// It is a **T2 tool, not a platform gate**: it stops content executing as code; it does\n// not certify anything to the host, and CO-4 data-fencing is still required for anything\n// that *reads* the content (the agent case).\n\nexport { SafeContent } from './SafeContent';\nexport type { SafeContentProps } from './SafeContent';\nexport { renderMdast } from './renderMdast';\nexport type { RenderMdastOptions, SafeContentComponents } from './renderMdast';\nexport { parseSafeMdast } from './parseSafeMdast';\nexport type { SafeMdastNode, SafeMdxAttribute, ParseSafeMdastOptions } from './parseSafeMdast';\nexport { sanitizeUrl } from './sanitizeUrl';\nexport { splitWikiLinks, parseWikiInner } from './wikilink';\nexport type { WikiLinkToken, WikiPart } from './wikilink';\n"],"mappings":";AAUA,SAAS,mBAAmB;AAE5B,SAAS,mBAAmB;AAE5B,SAAS,sBAAsB;AAE/B,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB,sBAAsB;","names":[]}
1
+ {"version":3,"sources":["../../src/safeContent/index.ts"],"sourcesContent":["// Safe content rendering — non-executable MDX (TRUST_MODES_SPEC §5.1, AGENT_AUTHORING\n// §10). The host/SDK-owned renderer an INTERPRETER app uses to render untrusted\n// Markdown/MDX-syntax content as data, with **no evaluator anywhere in the pipeline**.\n// This is the mandatory terminal for the MDX-from-mount gate (§10 delta 1) — a shared\n// (multi-writer / M3) board or wiki entry MUST render through here, never compiled MDX.\n//\n// It is a **T2 tool, not a platform gate**: it stops content executing as code; it does\n// not certify anything to the host, and CO-4 data-fencing is still required for anything\n// that *reads* the content (the agent case).\n//\n// R3-279 (phase 3): the implementation now lives in `@immediately-run/safe-content`\n// (the S3 content-framework tier's first extraction). This module — and every sibling\n// subpath below — is a byte-compat RE-EXPORT: `api-snapshot.json` is unchanged, every\n// existing `@immediately-run/sdk/safeContent/*` import keeps working, and no consumer\n// changes anywhere.\nexport * from '@immediately-run/safe-content';\n"],"mappings":"AAeA,cAAc;","names":[]}
@@ -10713,6 +10713,12 @@ function sectionId(text4) {
10713
10713
  if (!sectionLike) return null;
10714
10714
  return "sec-" + token.toLowerCase().replace(/\./g, "-");
10715
10715
  }
10716
+ function headingId(text4, options = {}) {
10717
+ const sec = options.sectionIds !== false ? sectionId(text4) : null;
10718
+ if (sec) return sec;
10719
+ const slug = textSlug(text4);
10720
+ return slug === "" ? "section" : slug;
10721
+ }
10716
10722
  function headingText(node2) {
10717
10723
  let out = "";
10718
10724
  const visit2 = (n) => {
@@ -10750,8 +10756,7 @@ var remarkHeadingAnchors = (options = {}) => (tree) => {
10750
10756
  const text4 = headingText(node2);
10751
10757
  const slug = textSlug(text4);
10752
10758
  const sec = sectionEnabled ? sectionId(text4) : null;
10753
- let baseId = sec ?? slug ?? "";
10754
- if (baseId === "") baseId = "section";
10759
+ const baseId = headingId(text4, { sectionIds: sectionEnabled });
10755
10760
  const n = seen.get(baseId) ?? 0;
10756
10761
  seen.set(baseId, n + 1);
10757
10762
  const id = n === 0 ? baseId : `${baseId}-${n}`;
@@ -10686,6 +10686,12 @@ function sectionId(text4) {
10686
10686
  if (!sectionLike) return null;
10687
10687
  return "sec-" + token.toLowerCase().replace(/\./g, "-");
10688
10688
  }
10689
+ function headingId(text4, options = {}) {
10690
+ const sec = options.sectionIds !== false ? sectionId(text4) : null;
10691
+ if (sec) return sec;
10692
+ const slug = textSlug(text4);
10693
+ return slug === "" ? "section" : slug;
10694
+ }
10689
10695
  function headingText(node2) {
10690
10696
  let out = "";
10691
10697
  const visit2 = (n) => {
@@ -10723,8 +10729,7 @@ var remarkHeadingAnchors = (options = {}) => (tree) => {
10723
10729
  const text4 = headingText(node2);
10724
10730
  const slug = textSlug(text4);
10725
10731
  const sec = sectionEnabled ? sectionId(text4) : null;
10726
- let baseId = sec ?? slug ?? "";
10727
- if (baseId === "") baseId = "section";
10732
+ const baseId = headingId(text4, { sectionIds: sectionEnabled });
10728
10733
  const n = seen.get(baseId) ?? 0;
10729
10734
  seen.set(baseId, n + 1);
10730
10735
  const id = n === 0 ? baseId : `${baseId}-${n}`;
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,62 +15,13 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var parseSafeMdast_exports = {};
30
20
  __export(parseSafeMdast_exports, {
31
- parseSafeMdast: () => parseSafeMdast
21
+ parseSafeMdast: () => import_safe_content.parseSafeMdast
32
22
  });
33
23
  module.exports = __toCommonJS(parseSafeMdast_exports);
34
- let depsPromise = null;
35
- function loadDeps() {
36
- if (!depsPromise) {
37
- depsPromise = import("./mdastDeps").then((m) => {
38
- const d = m;
39
- return {
40
- fromMarkdown: d.fromMarkdown,
41
- mdxJsx: d.mdxJsx,
42
- mdxJsxFromMarkdown: d.mdxJsxFromMarkdown,
43
- gfm: d.gfm,
44
- gfmFromMarkdown: d.gfmFromMarkdown,
45
- remarkAdmonitions: d.remarkAdmonitions,
46
- remarkWikiLinks: d.remarkWikiLinks,
47
- remarkHeadingAnchors: d.remarkHeadingAnchors
48
- };
49
- });
50
- }
51
- return depsPromise;
52
- }
53
- async function parseSafeMdast(source, options = {}) {
54
- const {
55
- fromMarkdown,
56
- mdxJsx,
57
- mdxJsxFromMarkdown,
58
- gfm,
59
- gfmFromMarkdown,
60
- remarkAdmonitions,
61
- remarkWikiLinks,
62
- remarkHeadingAnchors
63
- } = await loadDeps();
64
- const tree = fromMarkdown(source, {
65
- // `mdxJsx()` WITHOUT an acorn option → JSX tags + literal attrs; expressions are
66
- // raw strings, never estree. The mdx *expression* extension is intentionally
67
- // absent, so `{…}` in body text stays literal. GFM for tables/task-lists.
68
- extensions: [mdxJsx(), gfm()],
69
- mdastExtensions: [mdxJsxFromMarkdown(), gfmFromMarkdown()]
70
- });
71
- remarkAdmonitions()(tree);
72
- remarkWikiLinks()(tree);
73
- remarkHeadingAnchors({ sectionIds: options.sectionIds !== false })(tree);
74
- return tree;
75
- }
24
+ var import_safe_content = require("@immediately-run/safe-content");
76
25
  // Annotate the CommonJS export names for ESM import in node:
77
26
  0 && (module.exports = {
78
27
  parseSafeMdast
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/safeContent/parseSafeMdast.ts"],"sourcesContent":["// The no-acorn parse pipeline for the safe content renderer (TRUST_MODES_SPEC §5.1,\n// empirically verified 2026-07-07 against `@mdx-js/mdx` v3 / `micromark-extension-\n// mdx-jsx`). This is the load-bearing half of the fail-safe: `<Component/>` syntax\n// parses to an element node with **literal** attributes, and every expression\n// (`n={1+1}`, `f={fetch(\"/x\")}`, `{...spread}`) is captured as an **inert raw string\n// with no estree** — because we pass **NO acorn option** to `micromark-extension-mdx-\n// jsx`. There is therefore no evaluator anywhere in the pipeline (fail-safe), unlike\n// `@mdx-js/mdx`'s `compile({format:'mdx'})` which always wires acorn.\n//\n// The §5.1 residual guarantees are also here: the expression micromark extension is\n// **not** enabled (body `{…}` stays literal text), and **no `rehype-raw`** / raw-HTML\n// passthrough exists — raw HTML blocks arrive as inert `html` mdast nodes the renderer\n// prints as text, never injected.\n//\n// `micromark`/`mdast` are ESM-only. They are loaded with a memoised dynamic `import()`\n// (the transpiler's `compile.ts` pattern) so this module sits in the package's CJS\n// build too — a CJS consumer that never renders untrusted content never `require()`s\n// an ESM-only package, and one that does gets it via Node's ESM-from-CJS import. The\n// dynamic load changes only *when* the deps resolve, never the produced tree.\n//\n// The dynamic import targets `./mdastDeps` — a SINGLE self-contained artifact that a\n// dedicated build pass (`scripts/build-safecontent-deps.mjs`) inlines the whole ESM tree\n// into (see `mdastDeps.ts` for the WHY). This keeps the `import()` boundary (a consumer\n// that never renders safe content never loads the ~300KB parser) while making the imported\n// target one already-bundled file the immediately.run sandbox resolver can fetch without\n// walking the unified/micromark conditional-exports tree — the R3-213 on-host packaging\n// gap. In jest/ts-jest and the e2e bundle the same `./mdastDeps` resolves to the source\n// re-export module, which pulls the real deps from node_modules; the produced tree is\n// identical either way.\n\n// Type-only — the plugin VALUES are re-exported from (and inlined by) `./mdastDeps`; a\n// value import here would put a bare `@immediately-run/mdx-plugins` specifier in the dist\n// the sandbox resolver can't resolve on-host. `import type` is fully erased at build.\nimport type { HeadingAnchorOptions } from '@immediately-run/mdx-plugins';\n\n// A minimal structural mdast shape — we deliberately avoid a type dependency on the\n// ESM-only `mdast`/`unist` packages (which would break the CJS build's type surface).\nexport interface SafeMdastNode {\n type: string;\n value?: string;\n name?: string | null;\n url?: string;\n alt?: string | null;\n title?: string | null;\n depth?: number;\n ordered?: boolean;\n lang?: string | null;\n children?: SafeMdastNode[];\n attributes?: SafeMdxAttribute[];\n [key: string]: unknown;\n}\n\nexport interface SafeMdxAttribute {\n type: 'mdxJsxAttribute' | 'mdxJsxExpressionAttribute';\n name?: string;\n // A literal attribute carries a string; an expression attribute carries an\n // `mdxJsxAttributeValueExpression` object (a raw string, NO estree) or a string.\n value?: string | { type: string; value?: string } | null;\n}\n\n// `unified`'s `Plugin` type widens the return to `Transformer | void`; the safe path\n// invokes each transformer directly on the tree, so narrow it to a plain in-place mutator.\ntype MdastMutator = (tree: SafeMdastNode) => void;\n\ntype Deps = {\n fromMarkdown: (value: string, options: { extensions: unknown[]; mdastExtensions: unknown[] }) => SafeMdastNode;\n mdxJsx: () => unknown;\n mdxJsxFromMarkdown: () => unknown;\n gfm: () => unknown;\n gfmFromMarkdown: () => unknown;\n // The three shared kernel remark plugins, also inlined into `./mdastDeps` (see there).\n remarkAdmonitions: () => MdastMutator;\n remarkWikiLinks: () => MdastMutator;\n remarkHeadingAnchors: (o?: HeadingAnchorOptions) => MdastMutator;\n};\n\nlet depsPromise: Promise<Deps> | null = null;\n\nfunction loadDeps(): Promise<Deps> {\n if (!depsPromise) {\n // ONE dynamic import of the pre-inlined artifact (see the header note + `mdastDeps.ts`)\n // — the five ESM parser packages AND the shared remark plugins, none of which the\n // sandbox resolver can walk/resolve as bare specifiers on-host.\n depsPromise = import('./mdastDeps').then((m) => {\n const d = m as unknown as Deps;\n return {\n fromMarkdown: d.fromMarkdown,\n mdxJsx: d.mdxJsx,\n mdxJsxFromMarkdown: d.mdxJsxFromMarkdown,\n gfm: d.gfm,\n gfmFromMarkdown: d.gfmFromMarkdown,\n remarkAdmonitions: d.remarkAdmonitions,\n remarkWikiLinks: d.remarkWikiLinks,\n remarkHeadingAnchors: d.remarkHeadingAnchors,\n } as Deps;\n });\n }\n return depsPromise;\n}\n\nexport interface ParseSafeMdastOptions {\n /** `false` ⇒ headings use plain text-slug ids (the R3-186 base; no `sec-…` section\n * ids, no `data-slug`) — the `sectionIds:false` frontmatter opt-out, matching the\n * compiled path. Default (undefined/true) ⇒ section-like headings get `sec-…` ids\n * (R3-211). */\n sectionIds?: boolean;\n}\n\n/**\n * Parse untrusted Markdown/MDX-syntax source to an mdast tree with **no evaluator in\n * the pipeline**: JSX-as-data (no acorn), GFM on, the expression extension OFF, no\n * raw-HTML re-parse. The returned tree is safe to hand to `renderMdast` — expression\n * attributes are inert strings and raw HTML is inert `html` nodes.\n *\n * After the no-acorn parse it runs the SHARED kernel remark plugins — in the SAME order\n * as the compiled path's `compile.ts` (admonitions §12 → wiki-links §13 → heading/section\n * anchors §15/R3-211; GFM is already applied via the micromark extension above) — so the\n * safe subset renders identically in both standards. The plugins only emit element nodes\n * with LITERAL attributes and set `data.hProperties.id` on headings; they add no evaluator\n * and no acorn, preserving the §5.1 fail-safe.\n */\nexport async function parseSafeMdast(source: string, options: ParseSafeMdastOptions = {}): Promise<SafeMdastNode> {\n const {\n fromMarkdown,\n mdxJsx,\n mdxJsxFromMarkdown,\n gfm,\n gfmFromMarkdown,\n remarkAdmonitions,\n remarkWikiLinks,\n remarkHeadingAnchors,\n } = await loadDeps();\n const tree = fromMarkdown(source, {\n // `mdxJsx()` WITHOUT an acorn option → JSX tags + literal attrs; expressions are\n // raw strings, never estree. The mdx *expression* extension is intentionally\n // absent, so `{…}` in body text stays literal. GFM for tables/task-lists.\n extensions: [mdxJsx(), gfm()],\n mdastExtensions: [mdxJsxFromMarkdown(), gfmFromMarkdown()],\n });\n // The SHARED kernel remark plugins, in the SAME order as the compiled path's `compile.ts`\n // (admonitions §12 → wiki-links §13 → heading/section anchors §15/R3-211).\n remarkAdmonitions()(tree);\n remarkWikiLinks()(tree);\n remarkHeadingAnchors({ sectionIds: options.sectionIds !== false })(tree);\n return tree;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4EA,IAAI,cAAoC;AAExC,SAAS,WAA0B;AACjC,MAAI,CAAC,aAAa;AAIhB,kBAAc,OAAO,aAAa,EAAE,KAAK,CAAC,MAAM;AAC9C,YAAM,IAAI;AACV,aAAO;AAAA,QACL,cAAc,EAAE;AAAA,QAChB,QAAQ,EAAE;AAAA,QACV,oBAAoB,EAAE;AAAA,QACtB,KAAK,EAAE;AAAA,QACP,iBAAiB,EAAE;AAAA,QACnB,mBAAmB,EAAE;AAAA,QACrB,iBAAiB,EAAE;AAAA,QACnB,sBAAsB,EAAE;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAuBA,eAAsB,eAAe,QAAgB,UAAiC,CAAC,GAA2B;AAChH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,MAAM,SAAS;AACnB,QAAM,OAAO,aAAa,QAAQ;AAAA;AAAA;AAAA;AAAA,IAIhC,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC;AAAA,IAC5B,iBAAiB,CAAC,mBAAmB,GAAG,gBAAgB,CAAC;AAAA,EAC3D,CAAC;AAGD,oBAAkB,EAAE,IAAI;AACxB,kBAAgB,EAAE,IAAI;AACtB,uBAAqB,EAAE,YAAY,QAAQ,eAAe,MAAM,CAAC,EAAE,IAAI;AACvE,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/safeContent/parseSafeMdast.ts"],"sourcesContent":["// R3-279 (phase 3): re-export shim — the implementation lives in\n// `@immediately-run/safe-content`; this subpath keeps working byte-compatibly.\nexport { parseSafeMdast } from '@immediately-run/safe-content';\nexport type { SafeMdastNode, SafeMdxAttribute, ParseSafeMdastOptions } from '@immediately-run/safe-content';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,0BAA+B;","names":[]}
@@ -1,45 +1 @@
1
- interface SafeMdastNode {
2
- type: string;
3
- value?: string;
4
- name?: string | null;
5
- url?: string;
6
- alt?: string | null;
7
- title?: string | null;
8
- depth?: number;
9
- ordered?: boolean;
10
- lang?: string | null;
11
- children?: SafeMdastNode[];
12
- attributes?: SafeMdxAttribute[];
13
- [key: string]: unknown;
14
- }
15
- interface SafeMdxAttribute {
16
- type: 'mdxJsxAttribute' | 'mdxJsxExpressionAttribute';
17
- name?: string;
18
- value?: string | {
19
- type: string;
20
- value?: string;
21
- } | null;
22
- }
23
- interface ParseSafeMdastOptions {
24
- /** `false` ⇒ headings use plain text-slug ids (the R3-186 base; no `sec-…` section
25
- * ids, no `data-slug`) — the `sectionIds:false` frontmatter opt-out, matching the
26
- * compiled path. Default (undefined/true) ⇒ section-like headings get `sec-…` ids
27
- * (R3-211). */
28
- sectionIds?: boolean;
29
- }
30
- /**
31
- * Parse untrusted Markdown/MDX-syntax source to an mdast tree with **no evaluator in
32
- * the pipeline**: JSX-as-data (no acorn), GFM on, the expression extension OFF, no
33
- * raw-HTML re-parse. The returned tree is safe to hand to `renderMdast` — expression
34
- * attributes are inert strings and raw HTML is inert `html` nodes.
35
- *
36
- * After the no-acorn parse it runs the SHARED kernel remark plugins — in the SAME order
37
- * as the compiled path's `compile.ts` (admonitions §12 → wiki-links §13 → heading/section
38
- * anchors §15/R3-211; GFM is already applied via the micromark extension above) — so the
39
- * safe subset renders identically in both standards. The plugins only emit element nodes
40
- * with LITERAL attributes and set `data.hProperties.id` on headings; they add no evaluator
41
- * and no acorn, preserving the §5.1 fail-safe.
42
- */
43
- declare function parseSafeMdast(source: string, options?: ParseSafeMdastOptions): Promise<SafeMdastNode>;
44
-
45
- export { type ParseSafeMdastOptions, type SafeMdastNode, type SafeMdxAttribute, parseSafeMdast };
1
+ export { ParseSafeMdastOptions, SafeMdastNode, SafeMdxAttribute, parseSafeMdast } from '@immediately-run/safe-content';
@@ -1,45 +1 @@
1
- interface SafeMdastNode {
2
- type: string;
3
- value?: string;
4
- name?: string | null;
5
- url?: string;
6
- alt?: string | null;
7
- title?: string | null;
8
- depth?: number;
9
- ordered?: boolean;
10
- lang?: string | null;
11
- children?: SafeMdastNode[];
12
- attributes?: SafeMdxAttribute[];
13
- [key: string]: unknown;
14
- }
15
- interface SafeMdxAttribute {
16
- type: 'mdxJsxAttribute' | 'mdxJsxExpressionAttribute';
17
- name?: string;
18
- value?: string | {
19
- type: string;
20
- value?: string;
21
- } | null;
22
- }
23
- interface ParseSafeMdastOptions {
24
- /** `false` ⇒ headings use plain text-slug ids (the R3-186 base; no `sec-…` section
25
- * ids, no `data-slug`) — the `sectionIds:false` frontmatter opt-out, matching the
26
- * compiled path. Default (undefined/true) ⇒ section-like headings get `sec-…` ids
27
- * (R3-211). */
28
- sectionIds?: boolean;
29
- }
30
- /**
31
- * Parse untrusted Markdown/MDX-syntax source to an mdast tree with **no evaluator in
32
- * the pipeline**: JSX-as-data (no acorn), GFM on, the expression extension OFF, no
33
- * raw-HTML re-parse. The returned tree is safe to hand to `renderMdast` — expression
34
- * attributes are inert strings and raw HTML is inert `html` nodes.
35
- *
36
- * After the no-acorn parse it runs the SHARED kernel remark plugins — in the SAME order
37
- * as the compiled path's `compile.ts` (admonitions §12 → wiki-links §13 → heading/section
38
- * anchors §15/R3-211; GFM is already applied via the micromark extension above) — so the
39
- * safe subset renders identically in both standards. The plugins only emit element nodes
40
- * with LITERAL attributes and set `data.hProperties.id` on headings; they add no evaluator
41
- * and no acorn, preserving the §5.1 fail-safe.
42
- */
43
- declare function parseSafeMdast(source: string, options?: ParseSafeMdastOptions): Promise<SafeMdastNode>;
44
-
45
- export { type ParseSafeMdastOptions, type SafeMdastNode, type SafeMdxAttribute, parseSafeMdast };
1
+ export { ParseSafeMdastOptions, SafeMdastNode, SafeMdxAttribute, parseSafeMdast } from '@immediately-run/safe-content';
@@ -1,46 +1,5 @@
1
1
  import "../chunk-VHAA22YE.js";
2
- let depsPromise = null;
3
- function loadDeps() {
4
- if (!depsPromise) {
5
- depsPromise = import("./mdastDeps").then((m) => {
6
- const d = m;
7
- return {
8
- fromMarkdown: d.fromMarkdown,
9
- mdxJsx: d.mdxJsx,
10
- mdxJsxFromMarkdown: d.mdxJsxFromMarkdown,
11
- gfm: d.gfm,
12
- gfmFromMarkdown: d.gfmFromMarkdown,
13
- remarkAdmonitions: d.remarkAdmonitions,
14
- remarkWikiLinks: d.remarkWikiLinks,
15
- remarkHeadingAnchors: d.remarkHeadingAnchors
16
- };
17
- });
18
- }
19
- return depsPromise;
20
- }
21
- async function parseSafeMdast(source, options = {}) {
22
- const {
23
- fromMarkdown,
24
- mdxJsx,
25
- mdxJsxFromMarkdown,
26
- gfm,
27
- gfmFromMarkdown,
28
- remarkAdmonitions,
29
- remarkWikiLinks,
30
- remarkHeadingAnchors
31
- } = await loadDeps();
32
- const tree = fromMarkdown(source, {
33
- // `mdxJsx()` WITHOUT an acorn option → JSX tags + literal attrs; expressions are
34
- // raw strings, never estree. The mdx *expression* extension is intentionally
35
- // absent, so `{…}` in body text stays literal. GFM for tables/task-lists.
36
- extensions: [mdxJsx(), gfm()],
37
- mdastExtensions: [mdxJsxFromMarkdown(), gfmFromMarkdown()]
38
- });
39
- remarkAdmonitions()(tree);
40
- remarkWikiLinks()(tree);
41
- remarkHeadingAnchors({ sectionIds: options.sectionIds !== false })(tree);
42
- return tree;
43
- }
2
+ import { parseSafeMdast } from "@immediately-run/safe-content";
44
3
  export {
45
4
  parseSafeMdast
46
5
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/safeContent/parseSafeMdast.ts"],"sourcesContent":["// The no-acorn parse pipeline for the safe content renderer (TRUST_MODES_SPEC §5.1,\n// empirically verified 2026-07-07 against `@mdx-js/mdx` v3 / `micromark-extension-\n// mdx-jsx`). This is the load-bearing half of the fail-safe: `<Component/>` syntax\n// parses to an element node with **literal** attributes, and every expression\n// (`n={1+1}`, `f={fetch(\"/x\")}`, `{...spread}`) is captured as an **inert raw string\n// with no estree** — because we pass **NO acorn option** to `micromark-extension-mdx-\n// jsx`. There is therefore no evaluator anywhere in the pipeline (fail-safe), unlike\n// `@mdx-js/mdx`'s `compile({format:'mdx'})` which always wires acorn.\n//\n// The §5.1 residual guarantees are also here: the expression micromark extension is\n// **not** enabled (body `{…}` stays literal text), and **no `rehype-raw`** / raw-HTML\n// passthrough exists — raw HTML blocks arrive as inert `html` mdast nodes the renderer\n// prints as text, never injected.\n//\n// `micromark`/`mdast` are ESM-only. They are loaded with a memoised dynamic `import()`\n// (the transpiler's `compile.ts` pattern) so this module sits in the package's CJS\n// build too — a CJS consumer that never renders untrusted content never `require()`s\n// an ESM-only package, and one that does gets it via Node's ESM-from-CJS import. The\n// dynamic load changes only *when* the deps resolve, never the produced tree.\n//\n// The dynamic import targets `./mdastDeps` — a SINGLE self-contained artifact that a\n// dedicated build pass (`scripts/build-safecontent-deps.mjs`) inlines the whole ESM tree\n// into (see `mdastDeps.ts` for the WHY). This keeps the `import()` boundary (a consumer\n// that never renders safe content never loads the ~300KB parser) while making the imported\n// target one already-bundled file the immediately.run sandbox resolver can fetch without\n// walking the unified/micromark conditional-exports tree — the R3-213 on-host packaging\n// gap. In jest/ts-jest and the e2e bundle the same `./mdastDeps` resolves to the source\n// re-export module, which pulls the real deps from node_modules; the produced tree is\n// identical either way.\n\n// Type-only — the plugin VALUES are re-exported from (and inlined by) `./mdastDeps`; a\n// value import here would put a bare `@immediately-run/mdx-plugins` specifier in the dist\n// the sandbox resolver can't resolve on-host. `import type` is fully erased at build.\nimport type { HeadingAnchorOptions } from '@immediately-run/mdx-plugins';\n\n// A minimal structural mdast shape — we deliberately avoid a type dependency on the\n// ESM-only `mdast`/`unist` packages (which would break the CJS build's type surface).\nexport interface SafeMdastNode {\n type: string;\n value?: string;\n name?: string | null;\n url?: string;\n alt?: string | null;\n title?: string | null;\n depth?: number;\n ordered?: boolean;\n lang?: string | null;\n children?: SafeMdastNode[];\n attributes?: SafeMdxAttribute[];\n [key: string]: unknown;\n}\n\nexport interface SafeMdxAttribute {\n type: 'mdxJsxAttribute' | 'mdxJsxExpressionAttribute';\n name?: string;\n // A literal attribute carries a string; an expression attribute carries an\n // `mdxJsxAttributeValueExpression` object (a raw string, NO estree) or a string.\n value?: string | { type: string; value?: string } | null;\n}\n\n// `unified`'s `Plugin` type widens the return to `Transformer | void`; the safe path\n// invokes each transformer directly on the tree, so narrow it to a plain in-place mutator.\ntype MdastMutator = (tree: SafeMdastNode) => void;\n\ntype Deps = {\n fromMarkdown: (value: string, options: { extensions: unknown[]; mdastExtensions: unknown[] }) => SafeMdastNode;\n mdxJsx: () => unknown;\n mdxJsxFromMarkdown: () => unknown;\n gfm: () => unknown;\n gfmFromMarkdown: () => unknown;\n // The three shared kernel remark plugins, also inlined into `./mdastDeps` (see there).\n remarkAdmonitions: () => MdastMutator;\n remarkWikiLinks: () => MdastMutator;\n remarkHeadingAnchors: (o?: HeadingAnchorOptions) => MdastMutator;\n};\n\nlet depsPromise: Promise<Deps> | null = null;\n\nfunction loadDeps(): Promise<Deps> {\n if (!depsPromise) {\n // ONE dynamic import of the pre-inlined artifact (see the header note + `mdastDeps.ts`)\n // — the five ESM parser packages AND the shared remark plugins, none of which the\n // sandbox resolver can walk/resolve as bare specifiers on-host.\n depsPromise = import('./mdastDeps').then((m) => {\n const d = m as unknown as Deps;\n return {\n fromMarkdown: d.fromMarkdown,\n mdxJsx: d.mdxJsx,\n mdxJsxFromMarkdown: d.mdxJsxFromMarkdown,\n gfm: d.gfm,\n gfmFromMarkdown: d.gfmFromMarkdown,\n remarkAdmonitions: d.remarkAdmonitions,\n remarkWikiLinks: d.remarkWikiLinks,\n remarkHeadingAnchors: d.remarkHeadingAnchors,\n } as Deps;\n });\n }\n return depsPromise;\n}\n\nexport interface ParseSafeMdastOptions {\n /** `false` ⇒ headings use plain text-slug ids (the R3-186 base; no `sec-…` section\n * ids, no `data-slug`) — the `sectionIds:false` frontmatter opt-out, matching the\n * compiled path. Default (undefined/true) ⇒ section-like headings get `sec-…` ids\n * (R3-211). */\n sectionIds?: boolean;\n}\n\n/**\n * Parse untrusted Markdown/MDX-syntax source to an mdast tree with **no evaluator in\n * the pipeline**: JSX-as-data (no acorn), GFM on, the expression extension OFF, no\n * raw-HTML re-parse. The returned tree is safe to hand to `renderMdast` — expression\n * attributes are inert strings and raw HTML is inert `html` nodes.\n *\n * After the no-acorn parse it runs the SHARED kernel remark plugins — in the SAME order\n * as the compiled path's `compile.ts` (admonitions §12 → wiki-links §13 → heading/section\n * anchors §15/R3-211; GFM is already applied via the micromark extension above) — so the\n * safe subset renders identically in both standards. The plugins only emit element nodes\n * with LITERAL attributes and set `data.hProperties.id` on headings; they add no evaluator\n * and no acorn, preserving the §5.1 fail-safe.\n */\nexport async function parseSafeMdast(source: string, options: ParseSafeMdastOptions = {}): Promise<SafeMdastNode> {\n const {\n fromMarkdown,\n mdxJsx,\n mdxJsxFromMarkdown,\n gfm,\n gfmFromMarkdown,\n remarkAdmonitions,\n remarkWikiLinks,\n remarkHeadingAnchors,\n } = await loadDeps();\n const tree = fromMarkdown(source, {\n // `mdxJsx()` WITHOUT an acorn option → JSX tags + literal attrs; expressions are\n // raw strings, never estree. The mdx *expression* extension is intentionally\n // absent, so `{…}` in body text stays literal. GFM for tables/task-lists.\n extensions: [mdxJsx(), gfm()],\n mdastExtensions: [mdxJsxFromMarkdown(), gfmFromMarkdown()],\n });\n // The SHARED kernel remark plugins, in the SAME order as the compiled path's `compile.ts`\n // (admonitions §12 → wiki-links §13 → heading/section anchors §15/R3-211).\n remarkAdmonitions()(tree);\n remarkWikiLinks()(tree);\n remarkHeadingAnchors({ sectionIds: options.sectionIds !== false })(tree);\n return tree;\n}\n"],"mappings":";AA4EA,IAAI,cAAoC;AAExC,SAAS,WAA0B;AACjC,MAAI,CAAC,aAAa;AAIhB,kBAAc,OAAO,aAAa,EAAE,KAAK,CAAC,MAAM;AAC9C,YAAM,IAAI;AACV,aAAO;AAAA,QACL,cAAc,EAAE;AAAA,QAChB,QAAQ,EAAE;AAAA,QACV,oBAAoB,EAAE;AAAA,QACtB,KAAK,EAAE;AAAA,QACP,iBAAiB,EAAE;AAAA,QACnB,mBAAmB,EAAE;AAAA,QACrB,iBAAiB,EAAE;AAAA,QACnB,sBAAsB,EAAE;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAuBA,eAAsB,eAAe,QAAgB,UAAiC,CAAC,GAA2B;AAChH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,MAAM,SAAS;AACnB,QAAM,OAAO,aAAa,QAAQ;AAAA;AAAA;AAAA;AAAA,IAIhC,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC;AAAA,IAC5B,iBAAiB,CAAC,mBAAmB,GAAG,gBAAgB,CAAC;AAAA,EAC3D,CAAC;AAGD,oBAAkB,EAAE,IAAI;AACxB,kBAAgB,EAAE,IAAI;AACtB,uBAAqB,EAAE,YAAY,QAAQ,eAAe,MAAM,CAAC,EAAE,IAAI;AACvE,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/safeContent/parseSafeMdast.ts"],"sourcesContent":["// R3-279 (phase 3): re-export shim — the implementation lives in\n// `@immediately-run/safe-content`; this subpath keeps working byte-compatibly.\nexport { parseSafeMdast } from '@immediately-run/safe-content';\nexport type { SafeMdastNode, SafeMdxAttribute, ParseSafeMdastOptions } from '@immediately-run/safe-content';\n"],"mappings":";AAEA,SAAS,sBAAsB;","names":[]}
@@ -18,141 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var renderMdast_exports = {};
20
20
  __export(renderMdast_exports, {
21
- renderMdast: () => renderMdast
21
+ renderMdast: () => import_safe_content.renderMdast
22
22
  });
23
23
  module.exports = __toCommonJS(renderMdast_exports);
24
- var import_react = require("react");
25
- var import_sanitizeUrl = require("./sanitizeUrl");
26
- var import_wikilink = require("./wikilink");
27
- var import_linkSpace = require("../linkSpace");
28
- function literalProps(attributes) {
29
- const props = {};
30
- for (const attr of attributes ?? []) {
31
- if (attr.type !== "mdxJsxAttribute") continue;
32
- if (typeof attr.name !== "string") continue;
33
- if (typeof attr.value === "string") props[attr.name] = attr.value;
34
- else if (attr.value === null || attr.value === void 0) props[attr.name] = "";
35
- }
36
- return props;
37
- }
38
- let keyCounter = 0;
39
- const nextKey = () => `sc-${keyCounter++}`;
40
- function elementFor(tag, components) {
41
- return components?.[tag] ?? tag;
42
- }
43
- function renderWiki(token, opts) {
44
- const label = token.label ?? token.target;
45
- if ((0, import_linkSpace.resolveLinkTarget)(token.target).state === "invalid") return label;
46
- const href = opts.resolveWikiLink?.(token.target);
47
- const safe = href !== void 0 ? (0, import_sanitizeUrl.sanitizeUrl)(href) : void 0;
48
- if (safe === void 0) return label;
49
- return (0, import_react.createElement)(
50
- elementFor("a", opts.components),
51
- { href: safe, "data-wikilink": token.target, key: nextKey() },
52
- label
53
- );
54
- }
55
- function renderText(value, opts) {
56
- const parts = (0, import_wikilink.splitWikiLinks)(value);
57
- if (!parts) return value;
58
- return parts.map(
59
- (p, i) => "text" in p ? (0, import_react.createElement)(import_react.Fragment, { key: `t${i}` }, p.text) : (0, import_react.createElement)(import_react.Fragment, { key: `w${i}` }, renderWiki(p.wiki, opts))
60
- );
61
- }
62
- function renderChildren(node, opts) {
63
- return (node.children ?? []).map((c, i) => renderNode(c, opts, i));
64
- }
65
- const HEADING_TAGS = ["h1", "h2", "h3", "h4", "h5", "h6"];
66
- function renderNode(node, opts, index = 0) {
67
- const key = `n${index}`;
68
- switch (node.type) {
69
- case "root":
70
- return (0, import_react.createElement)(import_react.Fragment, { key }, ...renderChildren(node, opts));
71
- case "text":
72
- return renderText(node.value ?? "", opts);
73
- case "paragraph":
74
- return (0, import_react.createElement)("p", { key }, ...renderChildren(node, opts));
75
- case "heading": {
76
- const tag = HEADING_TAGS[Math.min(Math.max((node.depth ?? 1) - 1, 0), 5)];
77
- const hp = node.data?.hProperties;
78
- const headingProps = {};
79
- if (typeof hp?.id === "string") headingProps.id = hp.id;
80
- if (typeof hp?.["data-slug"] === "string") headingProps["data-slug"] = hp["data-slug"];
81
- return (0, import_react.createElement)(tag, { key, ...headingProps }, ...renderChildren(node, opts));
82
- }
83
- case "strong":
84
- return (0, import_react.createElement)("strong", { key }, ...renderChildren(node, opts));
85
- case "emphasis":
86
- return (0, import_react.createElement)("em", { key }, ...renderChildren(node, opts));
87
- case "delete":
88
- return (0, import_react.createElement)("del", { key }, ...renderChildren(node, opts));
89
- case "inlineCode":
90
- return (0, import_react.createElement)("code", { key }, node.value ?? "");
91
- case "code":
92
- return (0, import_react.createElement)("pre", { key }, (0, import_react.createElement)("code", null, node.value ?? ""));
93
- case "blockquote":
94
- return (0, import_react.createElement)("blockquote", { key }, ...renderChildren(node, opts));
95
- case "list":
96
- return (0, import_react.createElement)(node.ordered ? "ol" : "ul", { key }, ...renderChildren(node, opts));
97
- case "listItem":
98
- return (0, import_react.createElement)("li", { key }, ...renderChildren(node, opts));
99
- case "thematicBreak":
100
- return (0, import_react.createElement)("hr", { key });
101
- case "break":
102
- return (0, import_react.createElement)("br", { key });
103
- case "link": {
104
- const href = (0, import_sanitizeUrl.sanitizeUrl)(node.url);
105
- if (href === void 0) return (0, import_react.createElement)(import_react.Fragment, { key }, ...renderChildren(node, opts));
106
- return (0, import_react.createElement)(
107
- elementFor("a", opts.components),
108
- { key, href, title: node.title ?? void 0 },
109
- ...renderChildren(node, opts)
110
- );
111
- }
112
- case "image": {
113
- const src = (0, import_sanitizeUrl.sanitizeUrl)(node.url);
114
- if (src === void 0) return node.alt ? (0, import_react.createElement)(import_react.Fragment, { key }, node.alt) : null;
115
- return (0, import_react.createElement)(elementFor("img", opts.components), {
116
- key,
117
- src,
118
- alt: node.alt ?? "",
119
- title: node.title ?? void 0
120
- });
121
- }
122
- // GFM tables.
123
- case "table":
124
- return (0, import_react.createElement)("table", { key }, (0, import_react.createElement)("tbody", null, ...renderChildren(node, opts)));
125
- case "tableRow":
126
- return (0, import_react.createElement)("tr", { key }, ...renderChildren(node, opts));
127
- case "tableCell":
128
- return (0, import_react.createElement)("td", { key }, ...renderChildren(node, opts));
129
- // Raw HTML (`<script>`, `<div onclick>` at block level) → INERT TEXT. No
130
- // `rehype-raw`, never `dangerouslySetInnerHTML`. The literal markup is shown, not run.
131
- case "html":
132
- return (0, import_react.createElement)(import_react.Fragment, { key }, node.value ?? "");
133
- // JSX `<Component/>` syntax → registry lookup by NAME, literal props only.
134
- case "mdxJsxFlowElement":
135
- case "mdxJsxTextElement": {
136
- const name = typeof node.name === "string" ? node.name : "";
137
- const Component = name ? opts.components?.[name] : void 0;
138
- const children = renderChildren(node, opts);
139
- if (!Component) return (0, import_react.createElement)(import_react.Fragment, { key }, ...children);
140
- return (0, import_react.createElement)(Component, { key, ...literalProps(node.attributes) }, ...children);
141
- }
142
- // Inert expression nodes (should not occur — expression extension is off — but be
143
- // defensive if a tree from elsewhere carries them): render nothing.
144
- case "mdxFlowExpression":
145
- case "mdxTextExpression":
146
- case "mdxjsEsm":
147
- return null;
148
- default:
149
- return node.children ? (0, import_react.createElement)(import_react.Fragment, { key }, ...renderChildren(node, opts)) : null;
150
- }
151
- }
152
- function renderMdast(tree, options = {}) {
153
- keyCounter = 0;
154
- return renderNode(tree, options);
155
- }
24
+ var import_safe_content = require("@immediately-run/safe-content");
156
25
  // Annotate the CommonJS export names for ESM import in node:
157
26
  0 && (module.exports = {
158
27
  renderMdast
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/safeContent/renderMdast.tsx"],"sourcesContent":["import { createElement, Fragment, type ReactNode } from 'react';\nimport { sanitizeUrl } from './sanitizeUrl';\nimport { splitWikiLinks, type WikiLinkToken } from './wikilink';\nimport { resolveLinkTarget } from '../linkSpace';\nimport type { SafeMdastNode, SafeMdxAttribute } from './parseSafeMdast';\n\n// The mdast→React renderer for the safe content path (TRUST_MODES_SPEC §5.1). PURE\n// and synchronous — it only reads `node.type` off an already-parsed tree, so it\n// carries no ESM dep and is exhaustively unit-testable. Every security property lives\n// here:\n//\n// - **JSX tags resolve ONLY to a component registry, by name.** A `<Component/>`\n// node becomes `registry[name]` with **literal string props only**; an unknown tag\n// renders its children inert (a Fragment, no element) — so author-written `<div\n// onclick=…>`, `<img onerror=…>`, `<script>` never become an intrinsic element with\n// attacker attributes. (Block-level raw HTML arrives as an `html` node, below.)\n// - **Expression attributes are dropped.** `f={fetch(\"/x\")}` / `{...spread}` are\n// `mdxJsxExpressionAttribute` or object-valued `mdxJsxAttribute`s — never passed to\n// a component, never evaluated. (There is also no evaluator to reach — parse used\n// no acorn.)\n// - **Raw HTML is inert text.** `html` nodes render as their literal string via a\n// text node — never `dangerouslySetInnerHTML` (no `rehype-raw`).\n// - **URL-scheme sanitizer** on every `link`/`image` URL (`sanitizeUrl`).\n// - **Wikilinks resolve in-mount only** via an injected resolver; the renderer never\n// fetches.\n\nexport interface SafeContentComponents {\n /** Safe components an app exposes to `<Component/>` syntax (host/app-provided).\n * Looked up by the JSX tag name; anything not here renders inert. */\n [tag: string]: React.ComponentType<Record<string, string>>;\n}\n\nexport interface RenderMdastOptions {\n /** The component registry for `<Component/>` syntax. Absent ⇒ all JSX tags inert. */\n components?: SafeContentComponents;\n /**\n * Resolve a wikilink target to an href, **within the granted mount only** — a pure,\n * synchronous, mount-scoped lookup that MUST NOT fetch or reach out of the mount.\n * Return `undefined` for an unresolvable/out-of-mount target (rendered as inert\n * text). Absent ⇒ every wikilink renders as inert text.\n */\n resolveWikiLink?: (target: string) => string | undefined;\n}\n\n/** Extract the literal string props of a JSX element — `mdxJsxAttribute`s whose value\n * is a plain string. Expression attributes (object value) and spreads are DROPPED. */\nfunction literalProps(attributes: SafeMdxAttribute[] | undefined): Record<string, string> {\n const props: Record<string, string> = {};\n for (const attr of attributes ?? []) {\n if (attr.type !== 'mdxJsxAttribute') continue; // drop `{...spread}`\n if (typeof attr.name !== 'string') continue;\n // A literal attribute's value is a string (or null → boolean-ish `true`). An\n // expression value is an object (`mdxJsxAttributeValueExpression`) — DROP it: it\n // is an inert raw string, never a real value, and must never reach a component.\n if (typeof attr.value === 'string') props[attr.name] = attr.value;\n else if (attr.value === null || attr.value === undefined) props[attr.name] = '';\n // object-valued (expression) → skipped\n }\n return props;\n}\n\nlet keyCounter = 0;\nconst nextKey = () => `sc-${keyCounter++}`;\n\n/**\n * The element to build for a link/image: the host's registered override when it has one,\n * else the intrinsic tag.\n *\n * **Why this is safe.** `components` is the HOST's registry — the same one `<Component/>`\n * syntax resolves against — never author input. An author cannot add to it or choose one\n * here, because the lookup is by a FIXED key (`'a'`/`'img'`), not by anything read out of\n * the document. The URL is still `sanitizeUrl`'d before it is handed over, and only props\n * this renderer controls are passed. The trust boundary is unchanged: author text still\n * reaches nothing but children and a sanitized URL.\n *\n * **Why it is needed.** Without it, a safe-rendered document's links are raw `<a href>`,\n * so a click performs a REAL navigation. Inside an app's sandboxed iframe that is fatal —\n * the frame navigates away from the app, and in a routed host app it dies with\n * `Failed to construct 'URL': Invalid URL`. Hosts route links through a component for\n * exactly this reason, and the compiled-MDX path has always honoured that component; the\n * safe path silently ignored it, so one document behaved differently on the two renderers.\n */\nfunction elementFor(tag: 'a' | 'img', components: RenderMdastOptions['components']): React.ElementType {\n return (components?.[tag] as React.ElementType) ?? tag;\n}\n\n/** Render a wikilink token via the in-mount resolver, or inert text when it can't\n * resolve (never a network call — resolution is the injected mount-scoped callback). */\nfunction renderWiki(token: WikiLinkToken, opts: RenderMdastOptions): ReactNode {\n const label = token.label ?? token.target;\n // R3-273: a malformed `$fs:` target (not mount-absolute — catches scheme\n // smuggling) is inert BEFORE the injected resolver ever sees it, so every\n // consumer fails closed identically. Consumers implement their resolver on the\n // same shared `resolveLinkTarget` for well-formed targets.\n if (resolveLinkTarget(token.target).state === 'invalid') return label;\n const href = opts.resolveWikiLink?.(token.target);\n const safe = href !== undefined ? sanitizeUrl(href) : undefined;\n if (safe === undefined) return label; // inert text — unresolved or out-of-mount\n return createElement(\n elementFor('a', opts.components),\n { href: safe, 'data-wikilink': token.target, key: nextKey() },\n label,\n );\n}\n\n/** Render a `text` node, splitting any `[[…]]` wikilinks out of it. */\nfunction renderText(value: string, opts: RenderMdastOptions): ReactNode {\n const parts = splitWikiLinks(value);\n if (!parts) return value;\n return parts.map((p, i) =>\n 'text' in p\n ? createElement(Fragment, { key: `t${i}` }, p.text)\n : createElement(Fragment, { key: `w${i}` }, renderWiki(p.wiki, opts)),\n );\n}\n\nfunction renderChildren(node: SafeMdastNode, opts: RenderMdastOptions): ReactNode[] {\n return (node.children ?? []).map((c, i) => renderNode(c, opts, i));\n}\n\n// Standard mdast block/inline nodes → a FIXED, safe React element. We control every\n// attribute; author input only reaches text content and (sanitized) URLs.\nconst HEADING_TAGS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;\n\nfunction renderNode(node: SafeMdastNode, opts: RenderMdastOptions, index = 0): ReactNode {\n const key = `n${index}`;\n switch (node.type) {\n case 'root':\n return createElement(Fragment, { key }, ...renderChildren(node, opts));\n case 'text':\n return renderText(node.value ?? '', opts);\n case 'paragraph':\n return createElement('p', { key }, ...renderChildren(node, opts));\n case 'heading': {\n const tag = HEADING_TAGS[Math.min(Math.max((node.depth ?? 1) - 1, 0), 5)];\n // R3-213: the no-acorn path has no hast stage, so the heading id the shared\n // `remarkHeadingAnchors` plugin sets via `data.hProperties.id` (+ the `data-slug`\n // fallback, R3-211) must be translated to React props HERE, or headings render\n // id-less and deep-linking (`#sec-8-9`) breaks in the safe path. These are\n // plugin-computed literal strings, not author input — safe to pass through.\n const hp = (node.data as { hProperties?: Record<string, unknown> } | undefined)?.hProperties;\n const headingProps: Record<string, string> = {};\n if (typeof hp?.id === 'string') headingProps.id = hp.id;\n if (typeof hp?.['data-slug'] === 'string') headingProps['data-slug'] = hp['data-slug'];\n return createElement(tag, { key, ...headingProps }, ...renderChildren(node, opts));\n }\n case 'strong':\n return createElement('strong', { key }, ...renderChildren(node, opts));\n case 'emphasis':\n return createElement('em', { key }, ...renderChildren(node, opts));\n case 'delete':\n return createElement('del', { key }, ...renderChildren(node, opts));\n case 'inlineCode':\n return createElement('code', { key }, node.value ?? '');\n case 'code':\n return createElement('pre', { key }, createElement('code', null, node.value ?? ''));\n case 'blockquote':\n return createElement('blockquote', { key }, ...renderChildren(node, opts));\n case 'list':\n return createElement(node.ordered ? 'ol' : 'ul', { key }, ...renderChildren(node, opts));\n case 'listItem':\n return createElement('li', { key }, ...renderChildren(node, opts));\n case 'thematicBreak':\n return createElement('hr', { key });\n case 'break':\n return createElement('br', { key });\n case 'link': {\n const href = sanitizeUrl(node.url);\n // A rejected scheme → render the link TEXT only (inert), never an <a href>.\n if (href === undefined) return createElement(Fragment, { key }, ...renderChildren(node, opts));\n return createElement(\n elementFor('a', opts.components),\n { key, href, title: node.title ?? undefined },\n ...renderChildren(node, opts),\n );\n }\n case 'image': {\n const src = sanitizeUrl(node.url);\n if (src === undefined) return node.alt ? createElement(Fragment, { key }, node.alt) : null;\n return createElement(elementFor('img', opts.components), {\n key,\n src,\n alt: node.alt ?? '',\n title: node.title ?? undefined,\n });\n }\n // GFM tables.\n case 'table':\n return createElement('table', { key }, createElement('tbody', null, ...renderChildren(node, opts)));\n case 'tableRow':\n return createElement('tr', { key }, ...renderChildren(node, opts));\n case 'tableCell':\n return createElement('td', { key }, ...renderChildren(node, opts));\n // Raw HTML (`<script>`, `<div onclick>` at block level) → INERT TEXT. No\n // `rehype-raw`, never `dangerouslySetInnerHTML`. The literal markup is shown, not run.\n case 'html':\n return createElement(Fragment, { key }, node.value ?? '');\n // JSX `<Component/>` syntax → registry lookup by NAME, literal props only.\n case 'mdxJsxFlowElement':\n case 'mdxJsxTextElement': {\n const name = typeof node.name === 'string' ? node.name : '';\n const Component = name ? opts.components?.[name] : undefined;\n const children = renderChildren(node, opts);\n // Unknown tag (not in the registry) OR a fragment `<>` → render children inert,\n // NO element, NO author attributes. This is what neutralizes `<script>`/`<div\n // onclick>`/`<img onerror>` written as JSX.\n if (!Component) return createElement(Fragment, { key }, ...children);\n return createElement(Component, { key, ...literalProps(node.attributes) }, ...children);\n }\n // Inert expression nodes (should not occur — expression extension is off — but be\n // defensive if a tree from elsewhere carries them): render nothing.\n case 'mdxFlowExpression':\n case 'mdxTextExpression':\n case 'mdxjsEsm':\n return null;\n default:\n // Unknown node → render its children (never its raw value as markup).\n return node.children ? createElement(Fragment, { key }, ...renderChildren(node, opts)) : null;\n }\n}\n\n/**\n * Render a safe-parsed mdast tree to React. Pure and synchronous; carries every §5.1\n * security property (registry-only JSX, dropped expressions, inert raw HTML, URL\n * sanitizing, in-mount wikilinks). Feed it a tree from {@link parseSafeMdast}.\n */\nexport function renderMdast(tree: SafeMdastNode, options: RenderMdastOptions = {}): ReactNode {\n keyCounter = 0;\n return renderNode(tree, options);\n}\n"],"mappings":"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","names":[]}
1
+ {"version":3,"sources":["../../src/safeContent/renderMdast.tsx"],"sourcesContent":["// R3-279 (phase 3): re-export shim — the implementation lives in\n// `@immediately-run/safe-content`; this subpath keeps working byte-compatibly.\nexport { renderMdast } from '@immediately-run/safe-content';\nexport type { RenderMdastOptions, SafeContentComponents } from '@immediately-run/safe-content';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,0BAA4B;","names":[]}