@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.
- package/dist/analytics.cjs +47 -0
- package/dist/analytics.cjs.map +1 -0
- package/dist/analytics.d.cts +46 -0
- package/dist/analytics.d.ts +46 -0
- package/dist/analytics.js +21 -0
- package/dist/analytics.js.map +1 -0
- package/dist/corpus.cjs +91 -0
- package/dist/corpus.cjs.map +1 -0
- package/dist/corpus.d.cts +63 -0
- package/dist/corpus.d.ts +63 -0
- package/dist/corpus.js +62 -0
- package/dist/corpus.js.map +1 -0
- package/dist/generated/protocol.d.cts +1 -0
- package/dist/generated/protocol.d.ts +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -6
- package/dist/index.d.ts +5 -6
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/linkSpace.cjs +4 -36
- package/dist/linkSpace.cjs.map +1 -1
- package/dist/linkSpace.d.cts +3 -60
- package/dist/linkSpace.d.ts +3 -60
- package/dist/linkSpace.js +1 -33
- package/dist/linkSpace.js.map +1 -1
- package/dist/protocolSchemes.cjs +1 -0
- package/dist/protocolSchemes.cjs.map +1 -1
- package/dist/protocolSchemes.d.cts +1 -0
- package/dist/protocolSchemes.d.ts +1 -0
- package/dist/protocolSchemes.js +2 -0
- package/dist/protocolSchemes.js.map +1 -1
- package/dist/safeContent/SafeContent.cjs +2 -27
- package/dist/safeContent/SafeContent.cjs.map +1 -1
- package/dist/safeContent/SafeContent.d.cts +1 -13
- package/dist/safeContent/SafeContent.d.ts +1 -13
- package/dist/safeContent/SafeContent.js +1 -26
- package/dist/safeContent/SafeContent.js.map +1 -1
- package/dist/safeContent/index.cjs +3 -23
- package/dist/safeContent/index.cjs.map +1 -1
- package/dist/safeContent/index.d.cts +1 -6
- package/dist/safeContent/index.d.ts +1 -6
- package/dist/safeContent/index.js +1 -14
- package/dist/safeContent/index.js.map +1 -1
- package/dist/safeContent/mdastDeps.cjs +7 -2
- package/dist/safeContent/mdastDeps.js +7 -2
- package/dist/safeContent/parseSafeMdast.cjs +2 -53
- package/dist/safeContent/parseSafeMdast.cjs.map +1 -1
- package/dist/safeContent/parseSafeMdast.d.cts +1 -45
- package/dist/safeContent/parseSafeMdast.d.ts +1 -45
- package/dist/safeContent/parseSafeMdast.js +1 -42
- package/dist/safeContent/parseSafeMdast.js.map +1 -1
- package/dist/safeContent/renderMdast.cjs +2 -133
- package/dist/safeContent/renderMdast.cjs.map +1 -1
- package/dist/safeContent/renderMdast.d.cts +1 -27
- package/dist/safeContent/renderMdast.d.ts +1 -27
- package/dist/safeContent/renderMdast.js +1 -132
- package/dist/safeContent/renderMdast.js.map +1 -1
- package/dist/safeContent/sanitizeUrl.cjs +2 -12
- package/dist/safeContent/sanitizeUrl.cjs.map +1 -1
- package/dist/safeContent/sanitizeUrl.d.cts +1 -9
- package/dist/safeContent/sanitizeUrl.d.ts +1 -9
- package/dist/safeContent/sanitizeUrl.js +1 -11
- package/dist/safeContent/sanitizeUrl.js.map +1 -1
- package/dist/safeContent/wikilink.cjs +3 -35
- package/dist/safeContent/wikilink.cjs.map +1 -1
- package/dist/safeContent/wikilink.d.cts +1 -21
- package/dist/safeContent/wikilink.d.ts +1 -21
- package/dist/safeContent/wikilink.js +1 -33
- package/dist/safeContent/wikilink.js.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.cts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +7 -5
package/dist/index.d.cts
CHANGED
|
@@ -5,7 +5,8 @@ export { Include, RenderExportedComponent } from './components/Include.cjs';
|
|
|
5
5
|
export { SafeInclude } from './components/SafeInclude.cjs';
|
|
6
6
|
export { SourceCache, SourceReader, createSourceCache } from './sourceCache.cjs';
|
|
7
7
|
export { DEFAULT_MDX_COMPONENTS } from './components/MDXComponents.cjs';
|
|
8
|
-
export {
|
|
8
|
+
export { LinkSpaceContext } from './linkSpace.cjs';
|
|
9
|
+
export { CorpusContext, CorpusEntry, CorpusScope, fromCorpusPath, toCorpusPath, useCorpus, useCorpusEntries, useCorpusEntry, useCurrentEntry } from './corpus.cjs';
|
|
9
10
|
export { MountImage, MountImageProps } from './components/MountImage.cjs';
|
|
10
11
|
export { Route, RouteProps, Routes } from './components/Routes.cjs';
|
|
11
12
|
export { ObjectUrlState, useAllMetadata, useFileMetadata, useMetadataQuery, useObjectUrl } from './hooks.cjs';
|
|
@@ -19,6 +20,7 @@ export { FormFactor, FormFactorClass, Orientation, getFormFactor, onFormFactorCh
|
|
|
19
20
|
export { HostAttention, HostAttentionKind, NO_HOST_ATTENTION, getHostAttention, onHostAttentionChange, useHostAttention } from './hostAttention.cjs';
|
|
20
21
|
export { getRegion, useRegion } from './region.cjs';
|
|
21
22
|
export { Invite, MountQuery, MountRemoveReason, MountRule, RemovedMount, SandboxMount, SessionMount, SpaceError, acceptInvite, awaitMatchingMount, createSpace, declineInvite, findMount, getAppMountPath, getInvites, getMounts, getSessionMounts, importSettingsFromParent, listMyInvites, listPendingInvites, listSettingsApps, makeContentRef, mount, mountSpace, onInvitesChange, onMountsChange, onSessionMountsChange, openSettings, openSettingsOf, requestMount, requestSpace, resolveContentRef, resolveContentRefs, revokeInvite, unmountSpace, useInvites, useMounts, useSessionMounts, waitForMount } from './mounts.cjs';
|
|
23
|
+
export { AnalyticsAck, AnalyticsPropValue, emitAnalyticsEvent, recordRoute, track, trackRoute } from './analytics.cjs';
|
|
22
24
|
export { ContributeMode, ContributeOptions, ContributionEvent, ContributionResult, contribute } from './contribute.cjs';
|
|
23
25
|
export { ApiMethod, getCatalog, invoke, invokeStream, onCatalogChange, useCatalog } from './catalog.cjs';
|
|
24
26
|
export { RegionMessage, onRegionMessage, postToRegion, revealRegion, useRegionMessage } from './ipc.cjs';
|
|
@@ -40,12 +42,9 @@ export { LOADING_TIMINGS, LoadingRegion, Skeleton, SkeletonArchetype, SkeletonRo
|
|
|
40
42
|
export { StreamError, StreamFrame, StreamTransport, consumeStream, protocolStream } from './protocolStream.cjs';
|
|
41
43
|
export { ATTENDED_FIRST_FRAME_MS, ATTENDED_TIMEOUT_MS, Attendance, BoundedCallOptions, CallBounds, DeadlineBound, NETWORK_TIMEOUT_MS, PENDING_NOTICE_MS, PendingAttention, PendingState, ProtocolCancelledError, ProtocolTimeoutError, STREAM_IDLE_TIMEOUT_MS, SuspendableDeadline, UNATTENDED_TIMEOUT_MS, attendanceOf, attendanceReason, boundsFor, createSuspendableDeadline, firstFrameBoundsFor, firstFrameTimeoutFor, timeoutFor } from './protocolDeadline.cjs';
|
|
42
44
|
export { EvaluationContext, FileQueryResult, FilesMetadata, Metadata, MetadataQueryEntry, MetadataQueryFunction, MetadataQueryRecord, MetadataQueryResult, ModuleExports } from './sandboxTypes.cjs';
|
|
43
|
-
export
|
|
44
|
-
export { RenderMdastOptions, SafeContentComponents, renderMdast } from './safeContent/renderMdast.cjs';
|
|
45
|
-
export { ParseSafeMdastOptions, SafeMdastNode, SafeMdxAttribute, parseSafeMdast } from './safeContent/parseSafeMdast.cjs';
|
|
46
|
-
export { sanitizeUrl } from './safeContent/sanitizeUrl.cjs';
|
|
47
|
-
export { WikiLinkToken, WikiPart, parseWikiInner, splitWikiLinks } from './safeContent/wikilink.cjs';
|
|
45
|
+
export * from '@immediately-run/safe-content';
|
|
48
46
|
export { Admonition, AdmonitionType } from './components/Admonition.cjs';
|
|
47
|
+
export { FS_PREFIX, LinkSpace, ResolvedLinkTarget, normalizeAbsolute, resolveLinkTarget } from '@immediately-run/mdx-plugins';
|
|
49
48
|
export { GrantRecord, Member, ResolvedUser, Role, SpaceInfo, getSpaceMembers, inviteToSpace, listAllSpaces, listGrants, listSpaces, lookupUser, revokeGrant, setSpaceRole, unshareSpace } from './generated/spaces.cjs';
|
|
50
49
|
export { HeadingAnchor } from './components/HeadingAnchor.cjs';
|
|
51
50
|
export { ImmediatelyRunGlobal, getHostRuntime } from './hostRuntime.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ export { Include, RenderExportedComponent } from './components/Include.js';
|
|
|
5
5
|
export { SafeInclude } from './components/SafeInclude.js';
|
|
6
6
|
export { SourceCache, SourceReader, createSourceCache } from './sourceCache.js';
|
|
7
7
|
export { DEFAULT_MDX_COMPONENTS } from './components/MDXComponents.js';
|
|
8
|
-
export {
|
|
8
|
+
export { LinkSpaceContext } from './linkSpace.js';
|
|
9
|
+
export { CorpusContext, CorpusEntry, CorpusScope, fromCorpusPath, toCorpusPath, useCorpus, useCorpusEntries, useCorpusEntry, useCurrentEntry } from './corpus.js';
|
|
9
10
|
export { MountImage, MountImageProps } from './components/MountImage.js';
|
|
10
11
|
export { Route, RouteProps, Routes } from './components/Routes.js';
|
|
11
12
|
export { ObjectUrlState, useAllMetadata, useFileMetadata, useMetadataQuery, useObjectUrl } from './hooks.js';
|
|
@@ -19,6 +20,7 @@ export { FormFactor, FormFactorClass, Orientation, getFormFactor, onFormFactorCh
|
|
|
19
20
|
export { HostAttention, HostAttentionKind, NO_HOST_ATTENTION, getHostAttention, onHostAttentionChange, useHostAttention } from './hostAttention.js';
|
|
20
21
|
export { getRegion, useRegion } from './region.js';
|
|
21
22
|
export { Invite, MountQuery, MountRemoveReason, MountRule, RemovedMount, SandboxMount, SessionMount, SpaceError, acceptInvite, awaitMatchingMount, createSpace, declineInvite, findMount, getAppMountPath, getInvites, getMounts, getSessionMounts, importSettingsFromParent, listMyInvites, listPendingInvites, listSettingsApps, makeContentRef, mount, mountSpace, onInvitesChange, onMountsChange, onSessionMountsChange, openSettings, openSettingsOf, requestMount, requestSpace, resolveContentRef, resolveContentRefs, revokeInvite, unmountSpace, useInvites, useMounts, useSessionMounts, waitForMount } from './mounts.js';
|
|
23
|
+
export { AnalyticsAck, AnalyticsPropValue, emitAnalyticsEvent, recordRoute, track, trackRoute } from './analytics.js';
|
|
22
24
|
export { ContributeMode, ContributeOptions, ContributionEvent, ContributionResult, contribute } from './contribute.js';
|
|
23
25
|
export { ApiMethod, getCatalog, invoke, invokeStream, onCatalogChange, useCatalog } from './catalog.js';
|
|
24
26
|
export { RegionMessage, onRegionMessage, postToRegion, revealRegion, useRegionMessage } from './ipc.js';
|
|
@@ -40,12 +42,9 @@ export { LOADING_TIMINGS, LoadingRegion, Skeleton, SkeletonArchetype, SkeletonRo
|
|
|
40
42
|
export { StreamError, StreamFrame, StreamTransport, consumeStream, protocolStream } from './protocolStream.js';
|
|
41
43
|
export { ATTENDED_FIRST_FRAME_MS, ATTENDED_TIMEOUT_MS, Attendance, BoundedCallOptions, CallBounds, DeadlineBound, NETWORK_TIMEOUT_MS, PENDING_NOTICE_MS, PendingAttention, PendingState, ProtocolCancelledError, ProtocolTimeoutError, STREAM_IDLE_TIMEOUT_MS, SuspendableDeadline, UNATTENDED_TIMEOUT_MS, attendanceOf, attendanceReason, boundsFor, createSuspendableDeadline, firstFrameBoundsFor, firstFrameTimeoutFor, timeoutFor } from './protocolDeadline.js';
|
|
42
44
|
export { EvaluationContext, FileQueryResult, FilesMetadata, Metadata, MetadataQueryEntry, MetadataQueryFunction, MetadataQueryRecord, MetadataQueryResult, ModuleExports } from './sandboxTypes.js';
|
|
43
|
-
export
|
|
44
|
-
export { RenderMdastOptions, SafeContentComponents, renderMdast } from './safeContent/renderMdast.js';
|
|
45
|
-
export { ParseSafeMdastOptions, SafeMdastNode, SafeMdxAttribute, parseSafeMdast } from './safeContent/parseSafeMdast.js';
|
|
46
|
-
export { sanitizeUrl } from './safeContent/sanitizeUrl.js';
|
|
47
|
-
export { WikiLinkToken, WikiPart, parseWikiInner, splitWikiLinks } from './safeContent/wikilink.js';
|
|
45
|
+
export * from '@immediately-run/safe-content';
|
|
48
46
|
export { Admonition, AdmonitionType } from './components/Admonition.js';
|
|
47
|
+
export { FS_PREFIX, LinkSpace, ResolvedLinkTarget, normalizeAbsolute, resolveLinkTarget } from '@immediately-run/mdx-plugins';
|
|
49
48
|
export { GrantRecord, Member, ResolvedUser, Role, SpaceInfo, getSpaceMembers, inviteToSpace, listAllSpaces, listGrants, listSpaces, lookupUser, revokeGrant, setSpaceRole, unshareSpace } from './generated/spaces.js';
|
|
50
49
|
export { HeadingAnchor } from './components/HeadingAnchor.js';
|
|
51
50
|
export { ImmediatelyRunGlobal, getHostRuntime } from './hostRuntime.js';
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { SafeInclude } from "./components/SafeInclude";
|
|
|
7
7
|
export * from "./sourceCache";
|
|
8
8
|
export * from "./components/MDXComponents";
|
|
9
9
|
export * from "./linkSpace";
|
|
10
|
+
export * from "./corpus";
|
|
10
11
|
export * from "./components/MountImage";
|
|
11
12
|
export * from "./components/Routes";
|
|
12
13
|
export * from "./hooks";
|
|
@@ -20,6 +21,7 @@ export * from "./formFactor";
|
|
|
20
21
|
export * from "./hostAttention";
|
|
21
22
|
export * from "./region";
|
|
22
23
|
export * from "./mounts";
|
|
24
|
+
export * from "./analytics";
|
|
23
25
|
export * from "./contribute";
|
|
24
26
|
export * from "./catalog";
|
|
25
27
|
export * from "./ipc";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './MDXProvider';\nexport * from './routing';\nexport * from './boot';\nexport * from './components/Include';\n// Only the component is public. `stripFrontmatter`/`appMountRelative` are module-level\n// exports so they can be unit-tested directly, NOT public API — the SDK's surface is\n// backwards-compatible forever, so an internal helper exported for a test's convenience is a\n// permanent commitment made for the wrong reason.\nexport { SafeInclude } from './components/SafeInclude';\nexport * from './sourceCache';\nexport * from './components/MDXComponents';\nexport * from './linkSpace';\nexport * from './components/MountImage';\nexport * from './components/Routes';\nexport * from './hooks';\n// R3-276: the supported way for a viewer app to provide its own metadata store,\n// replacing a wholesale re-provision of `TinkerableContext` in app code.\nexport * from './metadataSource';\n// The deprecated injected-bundler adapters, re-exported so their deprecation notices\n// are visible in the published docs (R3-278; the window only narrows).\nexport { getInjectedMetadataEmitter, getInjectedMetadataSnapshot } from './injectedBundler';\nexport * from './auth';\nexport * from './theme';\nexport * from './editorContext';\nexport * from './editor';\nexport * from './formFactor';\nexport * from './hostAttention';\nexport * from './region';\nexport * from './mounts';\nexport * from './contribute';\nexport * from './catalog';\nexport * from './ipc';\nexport * from './dnd';\nexport * from './netFetch';\nexport * from './secrets';\nexport * from './llm';\nexport * from './diagnostics';\nexport * from './vcs';\nexport * from './onFsChange';\nexport * from './fs';\nexport * from './debug';\nexport * from './tasks';\nexport * from './launch';\nexport * from './runtime';\nexport * from './irMarkers';\nexport * from './ready';\nexport * from './loading';\nexport * from './protocolStream';\nexport * from './protocolDeadline';\nexport * from './sandboxTypes';\nexport * from './safeContent';\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAKd,SAAS,mBAAmB;AAC5B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AAGd,SAAS,4BAA4B,mCAAmC;AACxE,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './MDXProvider';\nexport * from './routing';\nexport * from './boot';\nexport * from './components/Include';\n// Only the component is public. `stripFrontmatter`/`appMountRelative` are module-level\n// exports so they can be unit-tested directly, NOT public API — the SDK's surface is\n// backwards-compatible forever, so an internal helper exported for a test's convenience is a\n// permanent commitment made for the wrong reason.\nexport { SafeInclude } from './components/SafeInclude';\nexport * from './sourceCache';\nexport * from './components/MDXComponents';\nexport * from './linkSpace';\nexport * from './corpus';\nexport * from './components/MountImage';\nexport * from './components/Routes';\nexport * from './hooks';\n// R3-276: the supported way for a viewer app to provide its own metadata store,\n// replacing a wholesale re-provision of `TinkerableContext` in app code.\nexport * from './metadataSource';\n// The deprecated injected-bundler adapters, re-exported so their deprecation notices\n// are visible in the published docs (R3-278; the window only narrows).\nexport { getInjectedMetadataEmitter, getInjectedMetadataSnapshot } from './injectedBundler';\nexport * from './auth';\nexport * from './theme';\nexport * from './editorContext';\nexport * from './editor';\nexport * from './formFactor';\nexport * from './hostAttention';\nexport * from './region';\nexport * from './mounts';\nexport * from './analytics';\nexport * from './contribute';\nexport * from './catalog';\nexport * from './ipc';\nexport * from './dnd';\nexport * from './netFetch';\nexport * from './secrets';\nexport * from './llm';\nexport * from './diagnostics';\nexport * from './vcs';\nexport * from './onFsChange';\nexport * from './fs';\nexport * from './debug';\nexport * from './tasks';\nexport * from './launch';\nexport * from './runtime';\nexport * from './irMarkers';\nexport * from './ready';\nexport * from './loading';\nexport * from './protocolStream';\nexport * from './protocolDeadline';\nexport * from './sandboxTypes';\nexport * from './safeContent';\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAKd,SAAS,mBAAmB;AAC5B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AAGd,SAAS,4BAA4B,mCAAmC;AACxE,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
package/dist/linkSpace.cjs
CHANGED
|
@@ -18,50 +18,18 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var linkSpace_exports = {};
|
|
20
20
|
__export(linkSpace_exports, {
|
|
21
|
-
FS_PREFIX: () => FS_PREFIX,
|
|
21
|
+
FS_PREFIX: () => import_mdx_plugins.FS_PREFIX,
|
|
22
22
|
LinkSpaceContext: () => LinkSpaceContext,
|
|
23
|
-
normalizeAbsolute: () => normalizeAbsolute,
|
|
24
|
-
resolveLinkTarget: () => resolveLinkTarget
|
|
23
|
+
normalizeAbsolute: () => import_mdx_plugins.normalizeAbsolute,
|
|
24
|
+
resolveLinkTarget: () => import_mdx_plugins.resolveLinkTarget
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(linkSpace_exports);
|
|
27
27
|
var import_react = require("react");
|
|
28
|
-
|
|
28
|
+
var import_mdx_plugins = require("@immediately-run/mdx-plugins");
|
|
29
29
|
const LinkSpaceContext = (0, import_react.createContext)({
|
|
30
30
|
corpusRoot: null,
|
|
31
31
|
bundleChrooted: false
|
|
32
32
|
});
|
|
33
|
-
const normalizeAbsolute = (path) => {
|
|
34
|
-
const out = [];
|
|
35
|
-
for (const seg of path.split("/")) {
|
|
36
|
-
if (seg === "" || seg === ".") continue;
|
|
37
|
-
if (seg === "..") out.pop();
|
|
38
|
-
else out.push(seg);
|
|
39
|
-
}
|
|
40
|
-
return "/" + out.join("/");
|
|
41
|
-
};
|
|
42
|
-
function resolveCorpusAbsolute(path, corpusRoot) {
|
|
43
|
-
const inner = normalizeAbsolute(path);
|
|
44
|
-
if (corpusRoot === null || corpusRoot === "/") return { state: "resolved", path: inner };
|
|
45
|
-
return { state: "resolved", path: normalizeAbsolute(corpusRoot + inner) };
|
|
46
|
-
}
|
|
47
|
-
function resolveLinkTarget(raw, opts = {}) {
|
|
48
|
-
if (raw.startsWith(FS_PREFIX)) {
|
|
49
|
-
const rest = raw.slice(FS_PREFIX.length);
|
|
50
|
-
if (!rest.startsWith("/")) return { state: "invalid" };
|
|
51
|
-
if (opts.bundleChrooted) return resolveCorpusAbsolute(rest, opts.corpusRoot ?? null);
|
|
52
|
-
return { state: "resolved", path: normalizeAbsolute(rest) };
|
|
53
|
-
}
|
|
54
|
-
if (raw.startsWith("/")) {
|
|
55
|
-
const corpusRoot = opts.corpusRoot ?? null;
|
|
56
|
-
if (corpusRoot !== null) {
|
|
57
|
-
return resolveCorpusAbsolute(raw, corpusRoot);
|
|
58
|
-
}
|
|
59
|
-
return { state: "resolved", path: normalizeAbsolute(raw) };
|
|
60
|
-
}
|
|
61
|
-
if (!opts.currentFile) return { state: "unresolvable" };
|
|
62
|
-
const dir = opts.currentFile.slice(0, opts.currentFile.lastIndexOf("/"));
|
|
63
|
-
return { state: "resolved", path: normalizeAbsolute(`${dir}/${raw}`) };
|
|
64
|
-
}
|
|
65
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
66
34
|
0 && (module.exports = {
|
|
67
35
|
FS_PREFIX,
|
package/dist/linkSpace.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/linkSpace.ts"],"sourcesContent":["// Link path spaces (R3-273; REPO_CONTENT_DISPATCH_SPEC §9 decision, 2026-08-17).\n//\n// A document link's target resolves in one of two spaces:\n//\n// - DEFAULT — the enclosing corpus's virtual filesystem. RELATIVE targets resolve\n// against the authoring file (identical in both spaces); ABSOLUTE targets\n// (`/x/y.mdx`) resolve from the corpus root when an enclosing `LinkSpaceContext`\n// declares one, else from the filesystem root. A non-corpus app declares nothing\n// and keeps today's behavior bit-for-bit (its fs root IS its only root).\n//\n// - `$fs:` — the explicit filesystem space: `$fs:/content/x.mdx` resolves from the\n// root of the filesystem the app reads, escaping corpus-relative addressing.\n//\n// `$fs:` changes ADDRESSING, never REACH: resolution is pure path arithmetic and\n// existence is checked against the same in-mount metadata the default space uses —\n// nothing is fetched, and a link can never name what the app cannot already read.\n// A malformed `$fs:` target (anything not mount-absolute — which also catches\n// scheme smuggling like `$fs:javascript:…`) is INVALID and must render as a broken\n// link, never an anchor.\n//\n// Corpus nesting: `LinkSpaceContext` providers nest, and the NEAREST one wins —\n// which is exactly the innermost-enclosing-corpus rule (bundle encapsulation): a\n// document rendered inside a nested corpus resolves against the nested corpus.\n\nimport { createContext } from 'react';\n\nexport
|
|
1
|
+
{"version":3,"sources":["../src/linkSpace.ts"],"sourcesContent":["// Link path spaces (R3-273; REPO_CONTENT_DISPATCH_SPEC §9 decision, 2026-08-17).\n// R3-279: the RESOLVER CORE (resolveLinkTarget / normalizeAbsolute / FS_PREFIX /\n// ResolvedLinkTarget) moved to `@immediately-run/mdx-plugins` — beside its parity\n// fixture — and is re-exported here unchanged (API-stable). This module keeps the\n// REACT surface (LinkSpaceContext): the provider a corpus-rendering app wraps its\n// document tree in. Consumers importing from '@immediately-run/sdk/linkSpace' see\n// exactly the same names.\n//\n// A document link's target resolves in one of two spaces:\n//\n// - DEFAULT — the enclosing corpus's virtual filesystem. RELATIVE targets resolve\n// against the authoring file (identical in both spaces); ABSOLUTE targets\n// (`/x/y.mdx`) resolve from the corpus root when an enclosing `LinkSpaceContext`\n// declares one, else from the filesystem root. A non-corpus app declares nothing\n// and keeps today's behavior bit-for-bit (its fs root IS its only root).\n//\n// - `$fs:` — the explicit filesystem space: `$fs:/content/x.mdx` resolves from the\n// root of the filesystem the app reads, escaping corpus-relative addressing.\n//\n// `$fs:` changes ADDRESSING, never REACH: resolution is pure path arithmetic and\n// existence is checked against the same in-mount metadata the default space uses —\n// nothing is fetched, and a link can never name what the app cannot already read.\n// A malformed `$fs:` target (anything not mount-absolute — which also catches\n// scheme smuggling like `$fs:javascript:…`) is INVALID and must render as a broken\n// link, never an anchor.\n//\n// Corpus nesting: `LinkSpaceContext` providers nest, and the NEAREST one wins —\n// which is exactly the innermost-enclosing-corpus rule (bundle encapsulation): a\n// document rendered inside a nested corpus resolves against the nested corpus.\n\nimport { createContext } from 'react';\n\nexport { FS_PREFIX, normalizeAbsolute, resolveLinkTarget } from '@immediately-run/mdx-plugins';\nexport type { ResolvedLinkTarget, LinkSpace } from '@immediately-run/mdx-plugins';\nimport type { LinkSpace as LinkSpaceShape } from '@immediately-run/mdx-plugins';\n\n/** Ambient link space. A corpus-rendering app wraps its document tree in\n * `<LinkSpaceContext value={{ corpusRoot }}>`; nesting a second provider inside a\n * rendered sub-corpus makes the innermost root win. */\nexport const LinkSpaceContext = createContext<LinkSpaceShape>({\n corpusRoot: null,\n bundleChrooted: false,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BA,mBAA8B;AAE9B,yBAAgE;AAOzD,MAAM,uBAAmB,4BAA8B;AAAA,EAC5D,YAAY;AAAA,EACZ,gBAAgB;AAClB,CAAC;","names":[]}
|
package/dist/linkSpace.d.cts
CHANGED
|
@@ -1,67 +1,10 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
+
import { LinkSpace } from '@immediately-run/mdx-plugins';
|
|
3
|
+
export { FS_PREFIX, LinkSpace, ResolvedLinkTarget, normalizeAbsolute, resolveLinkTarget } from '@immediately-run/mdx-plugins';
|
|
2
4
|
|
|
3
|
-
declare const FS_PREFIX = "$fs:";
|
|
4
|
-
interface LinkSpace {
|
|
5
|
-
/** Absolute filesystem path of the enclosing corpus's root (e.g. `/app/content`),
|
|
6
|
-
* or `null` when the document is not corpus-hosted (default). */
|
|
7
|
-
corpusRoot: string | null;
|
|
8
|
-
/**
|
|
9
|
-
* True when the filesystem this document resolves against is **chroot'd to the
|
|
10
|
-
* bundle** — i.e. the port the app holds was scoped to the bundle's subtree, so
|
|
11
|
-
* the mount root and the bundle root are the same directory
|
|
12
|
-
* (`BUNDLE_LAYERS_SPEC §9`; the `T2`/`T4` wrapper, R3-319 / BL-2).
|
|
13
|
-
*
|
|
14
|
-
* Under that grant `$fs:` **collapses to the scoped root**: `$fs:/p` and `/p`
|
|
15
|
-
* name the same byte, because there is no longer any "mount-absolute" space
|
|
16
|
-
* outside the bundle for `$fs:` to reach into. Without this flag the resolver
|
|
17
|
-
* would hand back a mount-absolute path that the chroot then re-roots anyway —
|
|
18
|
-
* a link that renders as valid and resolves somewhere the author did not mean.
|
|
19
|
-
*
|
|
20
|
-
* **This is an invariant to CREATE, not one to inherit** (`BUNDLE_LAYERS_SPEC
|
|
21
|
-
* §11`): the shipped resolver reads `{currentFile, corpusRoot}` and nothing
|
|
22
|
-
* else, so `$fs:` is bundle-anchored only if something says so. It lives here,
|
|
23
|
-
* in the resolver, rather than as a rule each caller applies by passing
|
|
24
|
-
* `corpusRoot: '/'` — an invariant the arithmetic carries cannot be forgotten
|
|
25
|
-
* at one call site out of five.
|
|
26
|
-
*/
|
|
27
|
-
bundleChrooted?: boolean;
|
|
28
|
-
}
|
|
29
5
|
/** Ambient link space. A corpus-rendering app wraps its document tree in
|
|
30
6
|
* `<LinkSpaceContext value={{ corpusRoot }}>`; nesting a second provider inside a
|
|
31
7
|
* rendered sub-corpus makes the innermost root win. */
|
|
32
8
|
declare const LinkSpaceContext: react.Context<LinkSpace>;
|
|
33
|
-
/** Collapse `.`/`..`/empty segments into a clean absolute path. `..` can never
|
|
34
|
-
* climb above the root — a (virtual) root's parent is itself, which is what keeps
|
|
35
|
-
* both the mount space and the corpus space closed under traversal. */
|
|
36
|
-
declare const normalizeAbsolute: (path: string) => string;
|
|
37
|
-
type ResolvedLinkTarget =
|
|
38
|
-
/** Resolved to an absolute filesystem path (existence NOT checked here). */
|
|
39
|
-
{
|
|
40
|
-
state: 'resolved';
|
|
41
|
-
path: string;
|
|
42
|
-
}
|
|
43
|
-
/** A relative target with no known authoring file — the caller may route
|
|
44
|
-
* optimistically (it cannot check existence or self-ness generically). */
|
|
45
|
-
| {
|
|
46
|
-
state: 'unresolvable';
|
|
47
|
-
}
|
|
48
|
-
/** A malformed `$fs:` target (not mount-absolute; includes scheme smuggling).
|
|
49
|
-
* Callers MUST render this broken/inert — never as an anchor. */
|
|
50
|
-
| {
|
|
51
|
-
state: 'invalid';
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Resolve a raw link target (a wikilink target or an in-app href's path half —
|
|
55
|
-
* fragment already split off) to an absolute filesystem path. THE shared resolver:
|
|
56
|
-
* the default `WikiLink`, the markdown `a` override, and safe-content consumers
|
|
57
|
-
* all route through this one function so the two render pipelines cannot drift.
|
|
58
|
-
*/
|
|
59
|
-
declare function resolveLinkTarget(raw: string, opts?: {
|
|
60
|
-
currentFile?: string;
|
|
61
|
-
corpusRoot?: string | null;
|
|
62
|
-
/** See `LinkSpace.bundleChrooted`. Under a bundle-chroot'd grant `$fs:`
|
|
63
|
-
* resolves in the corpus space, because they are the same space. */
|
|
64
|
-
bundleChrooted?: boolean;
|
|
65
|
-
}): ResolvedLinkTarget;
|
|
66
9
|
|
|
67
|
-
export {
|
|
10
|
+
export { LinkSpaceContext };
|
package/dist/linkSpace.d.ts
CHANGED
|
@@ -1,67 +1,10 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
+
import { LinkSpace } from '@immediately-run/mdx-plugins';
|
|
3
|
+
export { FS_PREFIX, LinkSpace, ResolvedLinkTarget, normalizeAbsolute, resolveLinkTarget } from '@immediately-run/mdx-plugins';
|
|
2
4
|
|
|
3
|
-
declare const FS_PREFIX = "$fs:";
|
|
4
|
-
interface LinkSpace {
|
|
5
|
-
/** Absolute filesystem path of the enclosing corpus's root (e.g. `/app/content`),
|
|
6
|
-
* or `null` when the document is not corpus-hosted (default). */
|
|
7
|
-
corpusRoot: string | null;
|
|
8
|
-
/**
|
|
9
|
-
* True when the filesystem this document resolves against is **chroot'd to the
|
|
10
|
-
* bundle** — i.e. the port the app holds was scoped to the bundle's subtree, so
|
|
11
|
-
* the mount root and the bundle root are the same directory
|
|
12
|
-
* (`BUNDLE_LAYERS_SPEC §9`; the `T2`/`T4` wrapper, R3-319 / BL-2).
|
|
13
|
-
*
|
|
14
|
-
* Under that grant `$fs:` **collapses to the scoped root**: `$fs:/p` and `/p`
|
|
15
|
-
* name the same byte, because there is no longer any "mount-absolute" space
|
|
16
|
-
* outside the bundle for `$fs:` to reach into. Without this flag the resolver
|
|
17
|
-
* would hand back a mount-absolute path that the chroot then re-roots anyway —
|
|
18
|
-
* a link that renders as valid and resolves somewhere the author did not mean.
|
|
19
|
-
*
|
|
20
|
-
* **This is an invariant to CREATE, not one to inherit** (`BUNDLE_LAYERS_SPEC
|
|
21
|
-
* §11`): the shipped resolver reads `{currentFile, corpusRoot}` and nothing
|
|
22
|
-
* else, so `$fs:` is bundle-anchored only if something says so. It lives here,
|
|
23
|
-
* in the resolver, rather than as a rule each caller applies by passing
|
|
24
|
-
* `corpusRoot: '/'` — an invariant the arithmetic carries cannot be forgotten
|
|
25
|
-
* at one call site out of five.
|
|
26
|
-
*/
|
|
27
|
-
bundleChrooted?: boolean;
|
|
28
|
-
}
|
|
29
5
|
/** Ambient link space. A corpus-rendering app wraps its document tree in
|
|
30
6
|
* `<LinkSpaceContext value={{ corpusRoot }}>`; nesting a second provider inside a
|
|
31
7
|
* rendered sub-corpus makes the innermost root win. */
|
|
32
8
|
declare const LinkSpaceContext: react.Context<LinkSpace>;
|
|
33
|
-
/** Collapse `.`/`..`/empty segments into a clean absolute path. `..` can never
|
|
34
|
-
* climb above the root — a (virtual) root's parent is itself, which is what keeps
|
|
35
|
-
* both the mount space and the corpus space closed under traversal. */
|
|
36
|
-
declare const normalizeAbsolute: (path: string) => string;
|
|
37
|
-
type ResolvedLinkTarget =
|
|
38
|
-
/** Resolved to an absolute filesystem path (existence NOT checked here). */
|
|
39
|
-
{
|
|
40
|
-
state: 'resolved';
|
|
41
|
-
path: string;
|
|
42
|
-
}
|
|
43
|
-
/** A relative target with no known authoring file — the caller may route
|
|
44
|
-
* optimistically (it cannot check existence or self-ness generically). */
|
|
45
|
-
| {
|
|
46
|
-
state: 'unresolvable';
|
|
47
|
-
}
|
|
48
|
-
/** A malformed `$fs:` target (not mount-absolute; includes scheme smuggling).
|
|
49
|
-
* Callers MUST render this broken/inert — never as an anchor. */
|
|
50
|
-
| {
|
|
51
|
-
state: 'invalid';
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Resolve a raw link target (a wikilink target or an in-app href's path half —
|
|
55
|
-
* fragment already split off) to an absolute filesystem path. THE shared resolver:
|
|
56
|
-
* the default `WikiLink`, the markdown `a` override, and safe-content consumers
|
|
57
|
-
* all route through this one function so the two render pipelines cannot drift.
|
|
58
|
-
*/
|
|
59
|
-
declare function resolveLinkTarget(raw: string, opts?: {
|
|
60
|
-
currentFile?: string;
|
|
61
|
-
corpusRoot?: string | null;
|
|
62
|
-
/** See `LinkSpace.bundleChrooted`. Under a bundle-chroot'd grant `$fs:`
|
|
63
|
-
* resolves in the corpus space, because they are the same space. */
|
|
64
|
-
bundleChrooted?: boolean;
|
|
65
|
-
}): ResolvedLinkTarget;
|
|
66
9
|
|
|
67
|
-
export {
|
|
10
|
+
export { LinkSpaceContext };
|
package/dist/linkSpace.js
CHANGED
|
@@ -1,42 +1,10 @@
|
|
|
1
1
|
import "./chunk-VHAA22YE.js";
|
|
2
2
|
import { createContext } from "react";
|
|
3
|
-
|
|
3
|
+
import { FS_PREFIX, normalizeAbsolute, resolveLinkTarget } from "@immediately-run/mdx-plugins";
|
|
4
4
|
const LinkSpaceContext = createContext({
|
|
5
5
|
corpusRoot: null,
|
|
6
6
|
bundleChrooted: false
|
|
7
7
|
});
|
|
8
|
-
const normalizeAbsolute = (path) => {
|
|
9
|
-
const out = [];
|
|
10
|
-
for (const seg of path.split("/")) {
|
|
11
|
-
if (seg === "" || seg === ".") continue;
|
|
12
|
-
if (seg === "..") out.pop();
|
|
13
|
-
else out.push(seg);
|
|
14
|
-
}
|
|
15
|
-
return "/" + out.join("/");
|
|
16
|
-
};
|
|
17
|
-
function resolveCorpusAbsolute(path, corpusRoot) {
|
|
18
|
-
const inner = normalizeAbsolute(path);
|
|
19
|
-
if (corpusRoot === null || corpusRoot === "/") return { state: "resolved", path: inner };
|
|
20
|
-
return { state: "resolved", path: normalizeAbsolute(corpusRoot + inner) };
|
|
21
|
-
}
|
|
22
|
-
function resolveLinkTarget(raw, opts = {}) {
|
|
23
|
-
if (raw.startsWith(FS_PREFIX)) {
|
|
24
|
-
const rest = raw.slice(FS_PREFIX.length);
|
|
25
|
-
if (!rest.startsWith("/")) return { state: "invalid" };
|
|
26
|
-
if (opts.bundleChrooted) return resolveCorpusAbsolute(rest, opts.corpusRoot ?? null);
|
|
27
|
-
return { state: "resolved", path: normalizeAbsolute(rest) };
|
|
28
|
-
}
|
|
29
|
-
if (raw.startsWith("/")) {
|
|
30
|
-
const corpusRoot = opts.corpusRoot ?? null;
|
|
31
|
-
if (corpusRoot !== null) {
|
|
32
|
-
return resolveCorpusAbsolute(raw, corpusRoot);
|
|
33
|
-
}
|
|
34
|
-
return { state: "resolved", path: normalizeAbsolute(raw) };
|
|
35
|
-
}
|
|
36
|
-
if (!opts.currentFile) return { state: "unresolvable" };
|
|
37
|
-
const dir = opts.currentFile.slice(0, opts.currentFile.lastIndexOf("/"));
|
|
38
|
-
return { state: "resolved", path: normalizeAbsolute(`${dir}/${raw}`) };
|
|
39
|
-
}
|
|
40
8
|
export {
|
|
41
9
|
FS_PREFIX,
|
|
42
10
|
LinkSpaceContext,
|
package/dist/linkSpace.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/linkSpace.ts"],"sourcesContent":["// Link path spaces (R3-273; REPO_CONTENT_DISPATCH_SPEC §9 decision, 2026-08-17).\n//\n// A document link's target resolves in one of two spaces:\n//\n// - DEFAULT — the enclosing corpus's virtual filesystem. RELATIVE targets resolve\n// against the authoring file (identical in both spaces); ABSOLUTE targets\n// (`/x/y.mdx`) resolve from the corpus root when an enclosing `LinkSpaceContext`\n// declares one, else from the filesystem root. A non-corpus app declares nothing\n// and keeps today's behavior bit-for-bit (its fs root IS its only root).\n//\n// - `$fs:` — the explicit filesystem space: `$fs:/content/x.mdx` resolves from the\n// root of the filesystem the app reads, escaping corpus-relative addressing.\n//\n// `$fs:` changes ADDRESSING, never REACH: resolution is pure path arithmetic and\n// existence is checked against the same in-mount metadata the default space uses —\n// nothing is fetched, and a link can never name what the app cannot already read.\n// A malformed `$fs:` target (anything not mount-absolute — which also catches\n// scheme smuggling like `$fs:javascript:…`) is INVALID and must render as a broken\n// link, never an anchor.\n//\n// Corpus nesting: `LinkSpaceContext` providers nest, and the NEAREST one wins —\n// which is exactly the innermost-enclosing-corpus rule (bundle encapsulation): a\n// document rendered inside a nested corpus resolves against the nested corpus.\n\nimport { createContext } from 'react';\n\nexport
|
|
1
|
+
{"version":3,"sources":["../src/linkSpace.ts"],"sourcesContent":["// Link path spaces (R3-273; REPO_CONTENT_DISPATCH_SPEC §9 decision, 2026-08-17).\n// R3-279: the RESOLVER CORE (resolveLinkTarget / normalizeAbsolute / FS_PREFIX /\n// ResolvedLinkTarget) moved to `@immediately-run/mdx-plugins` — beside its parity\n// fixture — and is re-exported here unchanged (API-stable). This module keeps the\n// REACT surface (LinkSpaceContext): the provider a corpus-rendering app wraps its\n// document tree in. Consumers importing from '@immediately-run/sdk/linkSpace' see\n// exactly the same names.\n//\n// A document link's target resolves in one of two spaces:\n//\n// - DEFAULT — the enclosing corpus's virtual filesystem. RELATIVE targets resolve\n// against the authoring file (identical in both spaces); ABSOLUTE targets\n// (`/x/y.mdx`) resolve from the corpus root when an enclosing `LinkSpaceContext`\n// declares one, else from the filesystem root. A non-corpus app declares nothing\n// and keeps today's behavior bit-for-bit (its fs root IS its only root).\n//\n// - `$fs:` — the explicit filesystem space: `$fs:/content/x.mdx` resolves from the\n// root of the filesystem the app reads, escaping corpus-relative addressing.\n//\n// `$fs:` changes ADDRESSING, never REACH: resolution is pure path arithmetic and\n// existence is checked against the same in-mount metadata the default space uses —\n// nothing is fetched, and a link can never name what the app cannot already read.\n// A malformed `$fs:` target (anything not mount-absolute — which also catches\n// scheme smuggling like `$fs:javascript:…`) is INVALID and must render as a broken\n// link, never an anchor.\n//\n// Corpus nesting: `LinkSpaceContext` providers nest, and the NEAREST one wins —\n// which is exactly the innermost-enclosing-corpus rule (bundle encapsulation): a\n// document rendered inside a nested corpus resolves against the nested corpus.\n\nimport { createContext } from 'react';\n\nexport { FS_PREFIX, normalizeAbsolute, resolveLinkTarget } from '@immediately-run/mdx-plugins';\nexport type { ResolvedLinkTarget, LinkSpace } from '@immediately-run/mdx-plugins';\nimport type { LinkSpace as LinkSpaceShape } from '@immediately-run/mdx-plugins';\n\n/** Ambient link space. A corpus-rendering app wraps its document tree in\n * `<LinkSpaceContext value={{ corpusRoot }}>`; nesting a second provider inside a\n * rendered sub-corpus makes the innermost root win. */\nexport const LinkSpaceContext = createContext<LinkSpaceShape>({\n corpusRoot: null,\n bundleChrooted: false,\n});\n"],"mappings":";AA8BA,SAAS,qBAAqB;AAE9B,SAAS,WAAW,mBAAmB,yBAAyB;AAOzD,MAAM,mBAAmB,cAA8B;AAAA,EAC5D,YAAY;AAAA,EACZ,gBAAgB;AAClB,CAAC;","names":[]}
|
package/dist/protocolSchemes.cjs
CHANGED
|
@@ -25,6 +25,7 @@ var import_protocol = require("./generated/protocol");
|
|
|
25
25
|
const PREFIX = "protocol-";
|
|
26
26
|
const schemeOf = (name) => name.slice(PREFIX.length);
|
|
27
27
|
const SCHEMES = {
|
|
28
|
+
[import_protocol.PROTOCOL_ANALYTICS]: schemeOf(import_protocol.PROTOCOL_ANALYTICS),
|
|
28
29
|
[import_protocol.PROTOCOL_CONTRIBUTE]: schemeOf(import_protocol.PROTOCOL_CONTRIBUTE),
|
|
29
30
|
[import_protocol.PROTOCOL_DND]: schemeOf(import_protocol.PROTOCOL_DND),
|
|
30
31
|
[import_protocol.PROTOCOL_EDITOR]: schemeOf(import_protocol.PROTOCOL_EDITOR),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/protocolSchemes.ts"],"sourcesContent":["// The `protocol-<scheme>` SCHEMES, derived from the wire names.\n//\n// `protocolRequest(scheme, method, params)` takes the scheme — `'theme'` — while the\n// wire name the frame dispatches on is `'protocol-theme'`; the frame adds the prefix.\n// So the typed service wrappers cannot pass the published `PROTOCOL_*` constant\n// directly, and spelling the scheme inline would put a second, unguarded copy of the\n// name back in the tree — exactly what R3-274c removes.\n//\n// Instead the schemes are *derived* from the wire names, keyed BY the wire name:\n//\n// protocolRequest(SCHEMES[PROTOCOL_THEME], 'set', [{ theme }])\n//\n// Keying by the constant is what makes the derivation unfalsifiable — there is no\n// second place to name the family, so there is no pair to get wrong. `schemeOf`\n// returns a template-literal conditional, so each value has a literal type (`'theme'`),\n// which buys two more things:\n//\n// - a wire name that stops matching `protocol-*` stops compiling here, rather than\n// silently producing an empty scheme at runtime;\n// - `check-protocol-snapshot.mjs` resolves `SCHEMES[PROTOCOL_THEME]` through the type\n// checker exactly like a plain literal, so the call sites stay visible to the gate.\n//\n// One export, deliberately: `./*` is a public subpath, so every name added here is\n// public API forever (ways_of_working §6, additive-only).\n//\n// This module is NOT generated — the derivation is the content — so it lives outside\n// `src/generated/`.\nimport {\n PROTOCOL_CONTRIBUTE,\n PROTOCOL_DND,\n PROTOCOL_EDITOR,\n PROTOCOL_FETCH,\n PROTOCOL_IPC,\n PROTOCOL_LAUNCH,\n PROTOCOL_LLM,\n PROTOCOL_SECRETS,\n PROTOCOL_SETTINGS,\n PROTOCOL_SPACES,\n PROTOCOL_TASK,\n PROTOCOL_THEME,\n PROTOCOL_VCS,\n} from './generated/protocol';\n\nconst PREFIX = 'protocol-';\n\n/** The scheme half of a `protocol-<scheme>` wire name. */\ntype SchemeOf<N extends string> = N extends `${typeof PREFIX}${infer S}` ? S : never;\n\n/**\n * `'protocol-theme'` → `'theme'`, as a literal type.\n *\n * The cast is the only place the derivation is asserted rather than computed; the\n * `N extends \\`protocol-${string}\\`` bound is what makes it sound — a wire name that is\n * not scheme-shaped is a compile error at the call, not a `never` at runtime.\n */\nconst schemeOf = <N extends `${typeof PREFIX}${string}`>(name: N): SchemeOf<N> =>\n name.slice(PREFIX.length) as SchemeOf<N>;\n\n/** Every `protocol-*` scheme the SDK speaks, keyed by its wire name. */\nexport const SCHEMES = {\n [PROTOCOL_CONTRIBUTE]: schemeOf(PROTOCOL_CONTRIBUTE),\n [PROTOCOL_DND]: schemeOf(PROTOCOL_DND),\n [PROTOCOL_EDITOR]: schemeOf(PROTOCOL_EDITOR),\n [PROTOCOL_FETCH]: schemeOf(PROTOCOL_FETCH),\n [PROTOCOL_IPC]: schemeOf(PROTOCOL_IPC),\n [PROTOCOL_LAUNCH]: schemeOf(PROTOCOL_LAUNCH),\n [PROTOCOL_LLM]: schemeOf(PROTOCOL_LLM),\n [PROTOCOL_SECRETS]: schemeOf(PROTOCOL_SECRETS),\n [PROTOCOL_SETTINGS]: schemeOf(PROTOCOL_SETTINGS),\n [PROTOCOL_SPACES]: schemeOf(PROTOCOL_SPACES),\n [PROTOCOL_TASK]: schemeOf(PROTOCOL_TASK),\n [PROTOCOL_THEME]: schemeOf(PROTOCOL_THEME),\n [PROTOCOL_VCS]: schemeOf(PROTOCOL_VCS),\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BA,
|
|
1
|
+
{"version":3,"sources":["../src/protocolSchemes.ts"],"sourcesContent":["// The `protocol-<scheme>` SCHEMES, derived from the wire names.\n//\n// `protocolRequest(scheme, method, params)` takes the scheme — `'theme'` — while the\n// wire name the frame dispatches on is `'protocol-theme'`; the frame adds the prefix.\n// So the typed service wrappers cannot pass the published `PROTOCOL_*` constant\n// directly, and spelling the scheme inline would put a second, unguarded copy of the\n// name back in the tree — exactly what R3-274c removes.\n//\n// Instead the schemes are *derived* from the wire names, keyed BY the wire name:\n//\n// protocolRequest(SCHEMES[PROTOCOL_THEME], 'set', [{ theme }])\n//\n// Keying by the constant is what makes the derivation unfalsifiable — there is no\n// second place to name the family, so there is no pair to get wrong. `schemeOf`\n// returns a template-literal conditional, so each value has a literal type (`'theme'`),\n// which buys two more things:\n//\n// - a wire name that stops matching `protocol-*` stops compiling here, rather than\n// silently producing an empty scheme at runtime;\n// - `check-protocol-snapshot.mjs` resolves `SCHEMES[PROTOCOL_THEME]` through the type\n// checker exactly like a plain literal, so the call sites stay visible to the gate.\n//\n// One export, deliberately: `./*` is a public subpath, so every name added here is\n// public API forever (ways_of_working §6, additive-only).\n//\n// This module is NOT generated — the derivation is the content — so it lives outside\n// `src/generated/`.\nimport {\n PROTOCOL_ANALYTICS,\n PROTOCOL_CONTRIBUTE,\n PROTOCOL_DND,\n PROTOCOL_EDITOR,\n PROTOCOL_FETCH,\n PROTOCOL_IPC,\n PROTOCOL_LAUNCH,\n PROTOCOL_LLM,\n PROTOCOL_SECRETS,\n PROTOCOL_SETTINGS,\n PROTOCOL_SPACES,\n PROTOCOL_TASK,\n PROTOCOL_THEME,\n PROTOCOL_VCS,\n} from './generated/protocol';\n\nconst PREFIX = 'protocol-';\n\n/** The scheme half of a `protocol-<scheme>` wire name. */\ntype SchemeOf<N extends string> = N extends `${typeof PREFIX}${infer S}` ? S : never;\n\n/**\n * `'protocol-theme'` → `'theme'`, as a literal type.\n *\n * The cast is the only place the derivation is asserted rather than computed; the\n * `N extends \\`protocol-${string}\\`` bound is what makes it sound — a wire name that is\n * not scheme-shaped is a compile error at the call, not a `never` at runtime.\n */\nconst schemeOf = <N extends `${typeof PREFIX}${string}`>(name: N): SchemeOf<N> =>\n name.slice(PREFIX.length) as SchemeOf<N>;\n\n/** Every `protocol-*` scheme the SDK speaks, keyed by its wire name. */\nexport const SCHEMES = {\n [PROTOCOL_ANALYTICS]: schemeOf(PROTOCOL_ANALYTICS),\n [PROTOCOL_CONTRIBUTE]: schemeOf(PROTOCOL_CONTRIBUTE),\n [PROTOCOL_DND]: schemeOf(PROTOCOL_DND),\n [PROTOCOL_EDITOR]: schemeOf(PROTOCOL_EDITOR),\n [PROTOCOL_FETCH]: schemeOf(PROTOCOL_FETCH),\n [PROTOCOL_IPC]: schemeOf(PROTOCOL_IPC),\n [PROTOCOL_LAUNCH]: schemeOf(PROTOCOL_LAUNCH),\n [PROTOCOL_LLM]: schemeOf(PROTOCOL_LLM),\n [PROTOCOL_SECRETS]: schemeOf(PROTOCOL_SECRETS),\n [PROTOCOL_SETTINGS]: schemeOf(PROTOCOL_SETTINGS),\n [PROTOCOL_SPACES]: schemeOf(PROTOCOL_SPACES),\n [PROTOCOL_TASK]: schemeOf(PROTOCOL_TASK),\n [PROTOCOL_THEME]: schemeOf(PROTOCOL_THEME),\n [PROTOCOL_VCS]: schemeOf(PROTOCOL_VCS),\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BA,sBAeO;AAEP,MAAM,SAAS;AAYf,MAAM,WAAW,CAAwC,SACvD,KAAK,MAAM,OAAO,MAAM;AAGnB,MAAM,UAAU;AAAA,EACrB,CAAC,kCAAkB,GAAG,SAAS,kCAAkB;AAAA,EACjD,CAAC,mCAAmB,GAAG,SAAS,mCAAmB;AAAA,EACnD,CAAC,4BAAY,GAAG,SAAS,4BAAY;AAAA,EACrC,CAAC,+BAAe,GAAG,SAAS,+BAAe;AAAA,EAC3C,CAAC,8BAAc,GAAG,SAAS,8BAAc;AAAA,EACzC,CAAC,4BAAY,GAAG,SAAS,4BAAY;AAAA,EACrC,CAAC,+BAAe,GAAG,SAAS,+BAAe;AAAA,EAC3C,CAAC,4BAAY,GAAG,SAAS,4BAAY;AAAA,EACrC,CAAC,gCAAgB,GAAG,SAAS,gCAAgB;AAAA,EAC7C,CAAC,iCAAiB,GAAG,SAAS,iCAAiB;AAAA,EAC/C,CAAC,+BAAe,GAAG,SAAS,+BAAe;AAAA,EAC3C,CAAC,6BAAa,GAAG,SAAS,6BAAa;AAAA,EACvC,CAAC,8BAAc,GAAG,SAAS,8BAAc;AAAA,EACzC,CAAC,4BAAY,GAAG,SAAS,4BAAY;AACvC;","names":[]}
|
package/dist/protocolSchemes.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "./chunk-VHAA22YE.js";
|
|
2
2
|
import {
|
|
3
|
+
PROTOCOL_ANALYTICS,
|
|
3
4
|
PROTOCOL_CONTRIBUTE,
|
|
4
5
|
PROTOCOL_DND,
|
|
5
6
|
PROTOCOL_EDITOR,
|
|
@@ -17,6 +18,7 @@ import {
|
|
|
17
18
|
const PREFIX = "protocol-";
|
|
18
19
|
const schemeOf = (name) => name.slice(PREFIX.length);
|
|
19
20
|
const SCHEMES = {
|
|
21
|
+
[PROTOCOL_ANALYTICS]: schemeOf(PROTOCOL_ANALYTICS),
|
|
20
22
|
[PROTOCOL_CONTRIBUTE]: schemeOf(PROTOCOL_CONTRIBUTE),
|
|
21
23
|
[PROTOCOL_DND]: schemeOf(PROTOCOL_DND),
|
|
22
24
|
[PROTOCOL_EDITOR]: schemeOf(PROTOCOL_EDITOR),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/protocolSchemes.ts"],"sourcesContent":["// The `protocol-<scheme>` SCHEMES, derived from the wire names.\n//\n// `protocolRequest(scheme, method, params)` takes the scheme — `'theme'` — while the\n// wire name the frame dispatches on is `'protocol-theme'`; the frame adds the prefix.\n// So the typed service wrappers cannot pass the published `PROTOCOL_*` constant\n// directly, and spelling the scheme inline would put a second, unguarded copy of the\n// name back in the tree — exactly what R3-274c removes.\n//\n// Instead the schemes are *derived* from the wire names, keyed BY the wire name:\n//\n// protocolRequest(SCHEMES[PROTOCOL_THEME], 'set', [{ theme }])\n//\n// Keying by the constant is what makes the derivation unfalsifiable — there is no\n// second place to name the family, so there is no pair to get wrong. `schemeOf`\n// returns a template-literal conditional, so each value has a literal type (`'theme'`),\n// which buys two more things:\n//\n// - a wire name that stops matching `protocol-*` stops compiling here, rather than\n// silently producing an empty scheme at runtime;\n// - `check-protocol-snapshot.mjs` resolves `SCHEMES[PROTOCOL_THEME]` through the type\n// checker exactly like a plain literal, so the call sites stay visible to the gate.\n//\n// One export, deliberately: `./*` is a public subpath, so every name added here is\n// public API forever (ways_of_working §6, additive-only).\n//\n// This module is NOT generated — the derivation is the content — so it lives outside\n// `src/generated/`.\nimport {\n PROTOCOL_CONTRIBUTE,\n PROTOCOL_DND,\n PROTOCOL_EDITOR,\n PROTOCOL_FETCH,\n PROTOCOL_IPC,\n PROTOCOL_LAUNCH,\n PROTOCOL_LLM,\n PROTOCOL_SECRETS,\n PROTOCOL_SETTINGS,\n PROTOCOL_SPACES,\n PROTOCOL_TASK,\n PROTOCOL_THEME,\n PROTOCOL_VCS,\n} from './generated/protocol';\n\nconst PREFIX = 'protocol-';\n\n/** The scheme half of a `protocol-<scheme>` wire name. */\ntype SchemeOf<N extends string> = N extends `${typeof PREFIX}${infer S}` ? S : never;\n\n/**\n * `'protocol-theme'` → `'theme'`, as a literal type.\n *\n * The cast is the only place the derivation is asserted rather than computed; the\n * `N extends \\`protocol-${string}\\`` bound is what makes it sound — a wire name that is\n * not scheme-shaped is a compile error at the call, not a `never` at runtime.\n */\nconst schemeOf = <N extends `${typeof PREFIX}${string}`>(name: N): SchemeOf<N> =>\n name.slice(PREFIX.length) as SchemeOf<N>;\n\n/** Every `protocol-*` scheme the SDK speaks, keyed by its wire name. */\nexport const SCHEMES = {\n [PROTOCOL_CONTRIBUTE]: schemeOf(PROTOCOL_CONTRIBUTE),\n [PROTOCOL_DND]: schemeOf(PROTOCOL_DND),\n [PROTOCOL_EDITOR]: schemeOf(PROTOCOL_EDITOR),\n [PROTOCOL_FETCH]: schemeOf(PROTOCOL_FETCH),\n [PROTOCOL_IPC]: schemeOf(PROTOCOL_IPC),\n [PROTOCOL_LAUNCH]: schemeOf(PROTOCOL_LAUNCH),\n [PROTOCOL_LLM]: schemeOf(PROTOCOL_LLM),\n [PROTOCOL_SECRETS]: schemeOf(PROTOCOL_SECRETS),\n [PROTOCOL_SETTINGS]: schemeOf(PROTOCOL_SETTINGS),\n [PROTOCOL_SPACES]: schemeOf(PROTOCOL_SPACES),\n [PROTOCOL_TASK]: schemeOf(PROTOCOL_TASK),\n [PROTOCOL_THEME]: schemeOf(PROTOCOL_THEME),\n [PROTOCOL_VCS]: schemeOf(PROTOCOL_VCS),\n} as const;\n"],"mappings":";AA2BA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,SAAS;AAYf,MAAM,WAAW,CAAwC,SACvD,KAAK,MAAM,OAAO,MAAM;AAGnB,MAAM,UAAU;AAAA,EACrB,CAAC,mBAAmB,GAAG,SAAS,mBAAmB;AAAA,EACnD,CAAC,YAAY,GAAG,SAAS,YAAY;AAAA,EACrC,CAAC,eAAe,GAAG,SAAS,eAAe;AAAA,EAC3C,CAAC,cAAc,GAAG,SAAS,cAAc;AAAA,EACzC,CAAC,YAAY,GAAG,SAAS,YAAY;AAAA,EACrC,CAAC,eAAe,GAAG,SAAS,eAAe;AAAA,EAC3C,CAAC,YAAY,GAAG,SAAS,YAAY;AAAA,EACrC,CAAC,gBAAgB,GAAG,SAAS,gBAAgB;AAAA,EAC7C,CAAC,iBAAiB,GAAG,SAAS,iBAAiB;AAAA,EAC/C,CAAC,eAAe,GAAG,SAAS,eAAe;AAAA,EAC3C,CAAC,aAAa,GAAG,SAAS,aAAa;AAAA,EACvC,CAAC,cAAc,GAAG,SAAS,cAAc;AAAA,EACzC,CAAC,YAAY,GAAG,SAAS,YAAY;AACvC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/protocolSchemes.ts"],"sourcesContent":["// The `protocol-<scheme>` SCHEMES, derived from the wire names.\n//\n// `protocolRequest(scheme, method, params)` takes the scheme — `'theme'` — while the\n// wire name the frame dispatches on is `'protocol-theme'`; the frame adds the prefix.\n// So the typed service wrappers cannot pass the published `PROTOCOL_*` constant\n// directly, and spelling the scheme inline would put a second, unguarded copy of the\n// name back in the tree — exactly what R3-274c removes.\n//\n// Instead the schemes are *derived* from the wire names, keyed BY the wire name:\n//\n// protocolRequest(SCHEMES[PROTOCOL_THEME], 'set', [{ theme }])\n//\n// Keying by the constant is what makes the derivation unfalsifiable — there is no\n// second place to name the family, so there is no pair to get wrong. `schemeOf`\n// returns a template-literal conditional, so each value has a literal type (`'theme'`),\n// which buys two more things:\n//\n// - a wire name that stops matching `protocol-*` stops compiling here, rather than\n// silently producing an empty scheme at runtime;\n// - `check-protocol-snapshot.mjs` resolves `SCHEMES[PROTOCOL_THEME]` through the type\n// checker exactly like a plain literal, so the call sites stay visible to the gate.\n//\n// One export, deliberately: `./*` is a public subpath, so every name added here is\n// public API forever (ways_of_working §6, additive-only).\n//\n// This module is NOT generated — the derivation is the content — so it lives outside\n// `src/generated/`.\nimport {\n PROTOCOL_ANALYTICS,\n PROTOCOL_CONTRIBUTE,\n PROTOCOL_DND,\n PROTOCOL_EDITOR,\n PROTOCOL_FETCH,\n PROTOCOL_IPC,\n PROTOCOL_LAUNCH,\n PROTOCOL_LLM,\n PROTOCOL_SECRETS,\n PROTOCOL_SETTINGS,\n PROTOCOL_SPACES,\n PROTOCOL_TASK,\n PROTOCOL_THEME,\n PROTOCOL_VCS,\n} from './generated/protocol';\n\nconst PREFIX = 'protocol-';\n\n/** The scheme half of a `protocol-<scheme>` wire name. */\ntype SchemeOf<N extends string> = N extends `${typeof PREFIX}${infer S}` ? S : never;\n\n/**\n * `'protocol-theme'` → `'theme'`, as a literal type.\n *\n * The cast is the only place the derivation is asserted rather than computed; the\n * `N extends \\`protocol-${string}\\`` bound is what makes it sound — a wire name that is\n * not scheme-shaped is a compile error at the call, not a `never` at runtime.\n */\nconst schemeOf = <N extends `${typeof PREFIX}${string}`>(name: N): SchemeOf<N> =>\n name.slice(PREFIX.length) as SchemeOf<N>;\n\n/** Every `protocol-*` scheme the SDK speaks, keyed by its wire name. */\nexport const SCHEMES = {\n [PROTOCOL_ANALYTICS]: schemeOf(PROTOCOL_ANALYTICS),\n [PROTOCOL_CONTRIBUTE]: schemeOf(PROTOCOL_CONTRIBUTE),\n [PROTOCOL_DND]: schemeOf(PROTOCOL_DND),\n [PROTOCOL_EDITOR]: schemeOf(PROTOCOL_EDITOR),\n [PROTOCOL_FETCH]: schemeOf(PROTOCOL_FETCH),\n [PROTOCOL_IPC]: schemeOf(PROTOCOL_IPC),\n [PROTOCOL_LAUNCH]: schemeOf(PROTOCOL_LAUNCH),\n [PROTOCOL_LLM]: schemeOf(PROTOCOL_LLM),\n [PROTOCOL_SECRETS]: schemeOf(PROTOCOL_SECRETS),\n [PROTOCOL_SETTINGS]: schemeOf(PROTOCOL_SETTINGS),\n [PROTOCOL_SPACES]: schemeOf(PROTOCOL_SPACES),\n [PROTOCOL_TASK]: schemeOf(PROTOCOL_TASK),\n [PROTOCOL_THEME]: schemeOf(PROTOCOL_THEME),\n [PROTOCOL_VCS]: schemeOf(PROTOCOL_VCS),\n} as const;\n"],"mappings":";AA2BA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,SAAS;AAYf,MAAM,WAAW,CAAwC,SACvD,KAAK,MAAM,OAAO,MAAM;AAGnB,MAAM,UAAU;AAAA,EACrB,CAAC,kBAAkB,GAAG,SAAS,kBAAkB;AAAA,EACjD,CAAC,mBAAmB,GAAG,SAAS,mBAAmB;AAAA,EACnD,CAAC,YAAY,GAAG,SAAS,YAAY;AAAA,EACrC,CAAC,eAAe,GAAG,SAAS,eAAe;AAAA,EAC3C,CAAC,cAAc,GAAG,SAAS,cAAc;AAAA,EACzC,CAAC,YAAY,GAAG,SAAS,YAAY;AAAA,EACrC,CAAC,eAAe,GAAG,SAAS,eAAe;AAAA,EAC3C,CAAC,YAAY,GAAG,SAAS,YAAY;AAAA,EACrC,CAAC,gBAAgB,GAAG,SAAS,gBAAgB;AAAA,EAC7C,CAAC,iBAAiB,GAAG,SAAS,iBAAiB;AAAA,EAC/C,CAAC,eAAe,GAAG,SAAS,eAAe;AAAA,EAC3C,CAAC,aAAa,GAAG,SAAS,aAAa;AAAA,EACvC,CAAC,cAAc,GAAG,SAAS,cAAc;AAAA,EACzC,CAAC,YAAY,GAAG,SAAS,YAAY;AACvC;","names":[]}
|
|
@@ -18,35 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var SafeContent_exports = {};
|
|
20
20
|
__export(SafeContent_exports, {
|
|
21
|
-
SafeContent: () => SafeContent
|
|
21
|
+
SafeContent: () => import_safe_content.SafeContent
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(SafeContent_exports);
|
|
24
|
-
var
|
|
25
|
-
var import_parseSafeMdast = require("./parseSafeMdast");
|
|
26
|
-
var import_renderMdast = require("./renderMdast");
|
|
27
|
-
function SafeContent({ source, fallback = null, ...options }) {
|
|
28
|
-
const [tree, setTree] = (0, import_react.useState)(null);
|
|
29
|
-
const runId = (0, import_react.useRef)(0);
|
|
30
|
-
(0, import_react.useEffect)(() => {
|
|
31
|
-
const id = ++runId.current;
|
|
32
|
-
setTree(null);
|
|
33
|
-
let cancelled = false;
|
|
34
|
-
(0, import_parseSafeMdast.parseSafeMdast)(source).then((parsed) => {
|
|
35
|
-
if (!cancelled && runId.current === id) setTree(parsed);
|
|
36
|
-
}).catch(() => {
|
|
37
|
-
if (!cancelled && runId.current === id) setTree(null);
|
|
38
|
-
});
|
|
39
|
-
return () => {
|
|
40
|
-
cancelled = true;
|
|
41
|
-
};
|
|
42
|
-
}, [source]);
|
|
43
|
-
const rendered = (0, import_react.useMemo)(
|
|
44
|
-
() => tree ? (0, import_renderMdast.renderMdast)(tree, options) : null,
|
|
45
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
-
[tree, options.components, options.resolveWikiLink]
|
|
47
|
-
);
|
|
48
|
-
return tree ? rendered : fallback;
|
|
49
|
-
}
|
|
24
|
+
var import_safe_content = require("@immediately-run/safe-content");
|
|
50
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
51
26
|
0 && (module.exports = {
|
|
52
27
|
SafeContent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/safeContent/SafeContent.tsx"],"sourcesContent":["
|
|
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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,0BAA4B;","names":[]}
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { RenderMdastOptions } from './renderMdast.cjs';
|
|
3
|
-
import './parseSafeMdast.cjs';
|
|
4
|
-
|
|
5
|
-
interface SafeContentProps extends RenderMdastOptions {
|
|
6
|
-
/** The untrusted Markdown/MDX-syntax source to render as data. */
|
|
7
|
-
source: string;
|
|
8
|
-
/** Rendered while the async parse is in flight (default: nothing). */
|
|
9
|
-
fallback?: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
declare function SafeContent({ source, fallback, ...options }: SafeContentProps): ReactNode;
|
|
12
|
-
|
|
13
|
-
export { SafeContent, type SafeContentProps };
|
|
1
|
+
export { SafeContent, SafeContentProps } from '@immediately-run/safe-content';
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { RenderMdastOptions } from './renderMdast.js';
|
|
3
|
-
import './parseSafeMdast.js';
|
|
4
|
-
|
|
5
|
-
interface SafeContentProps extends RenderMdastOptions {
|
|
6
|
-
/** The untrusted Markdown/MDX-syntax source to render as data. */
|
|
7
|
-
source: string;
|
|
8
|
-
/** Rendered while the async parse is in flight (default: nothing). */
|
|
9
|
-
fallback?: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
declare function SafeContent({ source, fallback, ...options }: SafeContentProps): ReactNode;
|
|
12
|
-
|
|
13
|
-
export { SafeContent, type SafeContentProps };
|
|
1
|
+
export { SafeContent, SafeContentProps } from '@immediately-run/safe-content';
|
|
@@ -1,30 +1,5 @@
|
|
|
1
1
|
import "../chunk-VHAA22YE.js";
|
|
2
|
-
import {
|
|
3
|
-
import { parseSafeMdast } from "./parseSafeMdast";
|
|
4
|
-
import { renderMdast } from "./renderMdast";
|
|
5
|
-
function SafeContent({ source, fallback = null, ...options }) {
|
|
6
|
-
const [tree, setTree] = useState(null);
|
|
7
|
-
const runId = useRef(0);
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
const id = ++runId.current;
|
|
10
|
-
setTree(null);
|
|
11
|
-
let cancelled = false;
|
|
12
|
-
parseSafeMdast(source).then((parsed) => {
|
|
13
|
-
if (!cancelled && runId.current === id) setTree(parsed);
|
|
14
|
-
}).catch(() => {
|
|
15
|
-
if (!cancelled && runId.current === id) setTree(null);
|
|
16
|
-
});
|
|
17
|
-
return () => {
|
|
18
|
-
cancelled = true;
|
|
19
|
-
};
|
|
20
|
-
}, [source]);
|
|
21
|
-
const rendered = useMemo(
|
|
22
|
-
() => tree ? renderMdast(tree, options) : null,
|
|
23
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
|
-
[tree, options.components, options.resolveWikiLink]
|
|
25
|
-
);
|
|
26
|
-
return tree ? rendered : fallback;
|
|
27
|
-
}
|
|
2
|
+
import { SafeContent } from "@immediately-run/safe-content";
|
|
28
3
|
export {
|
|
29
4
|
SafeContent
|
|
30
5
|
};
|