@ttsc/playground 0.30.4 → 0.31.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/README.md +6 -4
- package/lib/src/compiler/buildTsconfigJSON.d.ts +5 -0
- package/lib/src/compiler/buildTsconfigJSON.js +5 -0
- package/lib/src/compiler/buildTsconfigJSON.js.map +1 -1
- package/lib/src/compiler/createTypiaSourcePackMount.d.ts +9 -3
- package/lib/src/compiler/createTypiaSourcePackMount.js +9 -3
- package/lib/src/compiler/createTypiaSourcePackMount.js.map +1 -1
- package/lib/src/compiler/createWorkerCompiler.d.ts +5 -0
- package/lib/src/compiler/createWorkerCompiler.js +5 -0
- package/lib/src/compiler/createWorkerCompiler.js.map +1 -1
- package/lib/src/compiler/installDependenciesIntoMemFS.d.ts +5 -0
- package/lib/src/compiler/installDependenciesIntoMemFS.js +5 -0
- package/lib/src/compiler/installDependenciesIntoMemFS.js.map +1 -1
- package/lib/src/compiler/installTypiaSourcePack.d.ts +7 -2
- package/lib/src/compiler/installTypiaSourcePack.js +7 -2
- package/lib/src/compiler/installTypiaSourcePack.js.map +1 -1
- package/lib/src/compiler/internal/createWorkerCompilerService.d.ts +31 -0
- package/lib/src/compiler/internal/createWorkerCompilerService.js +22 -4
- package/lib/src/compiler/internal/createWorkerCompilerService.js.map +1 -1
- package/lib/src/compiler/internal/joinUnder.d.ts +5 -0
- package/lib/src/compiler/internal/joinUnder.js +5 -0
- package/lib/src/compiler/internal/joinUnder.js.map +1 -1
- package/lib/src/compiler/internal/parseLintDiagnostics.d.ts +5 -0
- package/lib/src/compiler/internal/parseLintDiagnostics.js +8 -3
- package/lib/src/compiler/internal/parseLintDiagnostics.js.map +1 -1
- package/lib/src/compiler/internal/safeParseTypiaTransform.d.ts +14 -1
- package/lib/src/compiler/internal/safeParseTypiaTransform.js +12 -1
- package/lib/src/compiler/internal/safeParseTypiaTransform.js.map +1 -1
- package/lib/src/compiler/lineColumnOf.d.ts +9 -1
- package/lib/src/compiler/lineColumnOf.js +23 -7
- package/lib/src/compiler/lineColumnOf.js.map +1 -1
- package/lib/src/compiler/loadTypiaSourcePack.d.ts +23 -1
- package/lib/src/compiler/loadTypiaSourcePack.js +48 -12
- package/lib/src/compiler/loadTypiaSourcePack.js.map +1 -1
- package/lib/src/compiler/mapDiagnostic.d.ts +7 -2
- package/lib/src/compiler/mapDiagnostic.js +53 -6
- package/lib/src/compiler/mapDiagnostic.js.map +1 -1
- package/lib/src/compiler/normalizeError.d.ts +9 -1
- package/lib/src/compiler/normalizeError.js +9 -1
- package/lib/src/compiler/normalizeError.js.map +1 -1
- package/lib/src/compiler/normalizeNodeModulePath.d.ts +5 -0
- package/lib/src/compiler/normalizeNodeModulePath.js +5 -0
- package/lib/src/compiler/normalizeNodeModulePath.js.map +1 -1
- package/lib/src/compiler/pickEmittedJS.d.ts +9 -2
- package/lib/src/compiler/pickEmittedJS.js +23 -6
- package/lib/src/compiler/pickEmittedJS.js.map +1 -1
- package/lib/src/npm/collectExternalPackageNames.d.ts +17 -0
- package/lib/src/npm/collectExternalPackageNames.js +51 -11
- package/lib/src/npm/collectExternalPackageNames.js.map +1 -1
- package/lib/src/npm/installPlaygroundDependencies.d.ts +10 -2
- package/lib/src/npm/installPlaygroundDependencies.js +18 -4
- package/lib/src/npm/installPlaygroundDependencies.js.map +1 -1
- package/lib/src/npm/internal/npmRegistry.d.ts +149 -2
- package/lib/src/npm/internal/npmRegistry.js +95 -4
- package/lib/src/npm/internal/npmRegistry.js.map +1 -1
- package/lib/src/npm/packageNameFromSpecifier.d.ts +5 -0
- package/lib/src/npm/packageNameFromSpecifier.js +7 -0
- package/lib/src/npm/packageNameFromSpecifier.js.map +1 -1
- package/lib/src/react/ConsoleViewer.d.ts +9 -0
- package/lib/src/react/ConsoleViewer.js +11 -2
- package/lib/src/react/ConsoleViewer.js.map +1 -1
- package/lib/src/react/DependencyProgressModal.d.ts +9 -0
- package/lib/src/react/DependencyProgressModal.js +9 -0
- package/lib/src/react/DependencyProgressModal.js.map +1 -1
- package/lib/src/react/DiagnosticsPanel.d.ts +9 -0
- package/lib/src/react/DiagnosticsPanel.js +9 -0
- package/lib/src/react/DiagnosticsPanel.js.map +1 -1
- package/lib/src/react/ExamplePicker.d.ts +9 -0
- package/lib/src/react/ExamplePicker.js +14 -2
- package/lib/src/react/ExamplePicker.js.map +1 -1
- package/lib/src/react/LintPane.d.ts +5 -0
- package/lib/src/react/LintPane.js +5 -0
- package/lib/src/react/LintPane.js.map +1 -1
- package/lib/src/react/OptionsPanel.d.ts +10 -0
- package/lib/src/react/OptionsPanel.js +19 -4
- package/lib/src/react/OptionsPanel.js.map +1 -1
- package/lib/src/react/PlaygroundShell.d.ts +13 -0
- package/lib/src/react/PlaygroundShell.js +17 -5
- package/lib/src/react/PlaygroundShell.js.map +1 -1
- package/lib/src/react/ResultViewer.d.ts +5 -0
- package/lib/src/react/ResultViewer.js +27 -7
- package/lib/src/react/ResultViewer.js.map +1 -1
- package/lib/src/react/SourceEditor.d.ts +10 -0
- package/lib/src/react/SourceEditor.js +10 -0
- package/lib/src/react/SourceEditor.js.map +1 -1
- package/lib/src/react/createCompilerClient.d.ts +5 -0
- package/lib/src/react/createCompilerClient.js +5 -0
- package/lib/src/react/createCompilerClient.js.map +1 -1
- package/lib/src/react/internal/PlaygroundCompilerLifecycle.d.ts +64 -1
- package/lib/src/react/internal/PlaygroundCompilerLifecycle.js +48 -0
- package/lib/src/react/internal/PlaygroundCompilerLifecycle.js.map +1 -1
- package/lib/src/react/internal/PlaygroundExecutionLifecycle.d.ts +42 -2
- package/lib/src/react/internal/PlaygroundExecutionLifecycle.js +18 -0
- package/lib/src/react/internal/PlaygroundExecutionLifecycle.js.map +1 -1
- package/lib/src/react/internal/recoverTerminalCompilerWorker.d.ts +46 -4
- package/lib/src/react/internal/recoverTerminalCompilerWorker.js +14 -1
- package/lib/src/react/internal/recoverTerminalCompilerWorker.js.map +1 -1
- package/lib/src/sandbox/createSandboxRequire.d.ts +12 -3
- package/lib/src/sandbox/createSandboxRequire.js +26 -12
- package/lib/src/sandbox/createSandboxRequire.js.map +1 -1
- package/lib/src/sandbox/loadTypiaRuntimePack.d.ts +22 -0
- package/lib/src/sandbox/loadTypiaRuntimePack.js +30 -1
- package/lib/src/sandbox/loadTypiaRuntimePack.js.map +1 -1
- package/lib/src/structures/IBuildTsconfigOptions.d.ts +9 -1
- package/lib/src/structures/ICompilerService.d.ts +112 -2
- package/lib/src/structures/IConsoleMessage.d.ts +5 -0
- package/lib/src/structures/ICreateCompilerClientOptions.d.ts +9 -2
- package/lib/src/structures/ICreateWorkerCompilerOptions.d.ts +11 -3
- package/lib/src/structures/IInstallTypiaSourcePackOptions.d.ts +7 -1
- package/lib/src/structures/ILintPluginConfig.d.ts +8 -1
- package/lib/src/structures/ILoadTypiaRuntimePackOptions.d.ts +8 -1
- package/lib/src/structures/IOptionToggle.d.ts +5 -0
- package/lib/src/structures/IPlaygroundDependencyInstallOptions.d.ts +41 -6
- package/lib/src/structures/IPlaygroundDependencyInstallResult.d.ts +8 -1
- package/lib/src/structures/IPlaygroundDependencyPackage.d.ts +9 -1
- package/lib/src/structures/IPlaygroundDependencyProgress.d.ts +9 -1
- package/lib/src/structures/IPlaygroundDependencyProgressPhase.d.ts +7 -2
- package/lib/src/structures/IPlaygroundDependencyRequest.d.ts +8 -1
- package/lib/src/structures/IPlaygroundExample.d.ts +5 -0
- package/lib/src/structures/IPlaygroundInstalledDependency.d.ts +8 -1
- package/lib/src/structures/IPlaygroundShellProps.d.ts +53 -19
- package/lib/src/structures/ISourceEditorProps.d.ts +16 -1
- package/lib/src/structures/ITransformOptions.d.ts +5 -0
- package/lib/src/structures/ITypiaPluginConfig.d.ts +25 -7
- package/package.json +6 -4
- package/src/compiler/buildTsconfigJSON.ts +5 -0
- package/src/compiler/createTypiaSourcePackMount.ts +9 -3
- package/src/compiler/createWorkerCompiler.ts +5 -0
- package/src/compiler/installDependenciesIntoMemFS.ts +5 -0
- package/src/compiler/installTypiaSourcePack.ts +7 -2
- package/src/compiler/internal/createWorkerCompilerService.ts +47 -4
- package/src/compiler/internal/joinUnder.ts +5 -0
- package/src/compiler/internal/parseLintDiagnostics.ts +8 -3
- package/src/compiler/internal/safeParseTypiaTransform.ts +25 -2
- package/src/compiler/lineColumnOf.ts +24 -8
- package/src/compiler/loadTypiaSourcePack.ts +57 -14
- package/src/compiler/mapDiagnostic.ts +67 -7
- package/src/compiler/normalizeError.ts +9 -1
- package/src/compiler/normalizeNodeModulePath.ts +5 -0
- package/src/compiler/pickEmittedJS.ts +22 -5
- package/src/npm/collectExternalPackageNames.ts +54 -13
- package/src/npm/installPlaygroundDependencies.ts +18 -6
- package/src/npm/internal/npmRegistry.ts +156 -4
- package/src/npm/packageNameFromSpecifier.ts +6 -0
- package/src/react/ConsoleViewer.tsx +10 -1
- package/src/react/DependencyProgressModal.tsx +9 -0
- package/src/react/DiagnosticsPanel.tsx +9 -0
- package/src/react/ExamplePicker.tsx +22 -6
- package/src/react/LintPane.tsx +5 -0
- package/src/react/OptionsPanel.tsx +22 -4
- package/src/react/PlaygroundShell.tsx +17 -5
- package/src/react/ResultViewer.tsx +28 -7
- package/src/react/SourceEditor.tsx +10 -0
- package/src/react/createCompilerClient.ts +5 -0
- package/src/react/internal/PlaygroundCompilerLifecycle.ts +64 -1
- package/src/react/internal/PlaygroundExecutionLifecycle.ts +44 -2
- package/src/react/internal/recoverTerminalCompilerWorker.ts +48 -4
- package/src/sandbox/createSandboxRequire.ts +28 -15
- package/src/sandbox/loadTypiaRuntimePack.ts +35 -2
- package/src/structures/IBuildTsconfigOptions.ts +13 -1
- package/src/structures/ICompilerService.ts +119 -2
- package/src/structures/IConsoleMessage.ts +5 -0
- package/src/structures/ICreateCompilerClientOptions.ts +9 -2
- package/src/structures/ICreateWorkerCompilerOptions.ts +15 -3
- package/src/structures/IInstallTypiaSourcePackOptions.ts +11 -1
- package/src/structures/ILintPluginConfig.ts +8 -1
- package/src/structures/ILoadTypiaRuntimePackOptions.ts +8 -1
- package/src/structures/IOptionToggle.ts +5 -0
- package/src/structures/IPlaygroundDependencyInstallOptions.ts +56 -6
- package/src/structures/IPlaygroundDependencyInstallResult.ts +12 -1
- package/src/structures/IPlaygroundDependencyPackage.ts +11 -1
- package/src/structures/IPlaygroundDependencyProgress.ts +9 -1
- package/src/structures/IPlaygroundDependencyProgressPhase.ts +7 -2
- package/src/structures/IPlaygroundDependencyRequest.ts +10 -1
- package/src/structures/IPlaygroundExample.ts +6 -0
- package/src/structures/IPlaygroundInstalledDependency.ts +11 -1
- package/src/structures/IPlaygroundShellProps.ts +62 -22
- package/src/structures/ISourceEditorProps.ts +20 -1
- package/src/structures/ITransformOptions.ts +7 -0
- package/src/structures/ITypiaPluginConfig.ts +31 -7
|
@@ -6,58 +6,150 @@ import type { ITransformOptions } from "./ITransformOptions";
|
|
|
6
6
|
* (UI side) returns a tgrid Driver bound to this shape. Sites that need an
|
|
7
7
|
* `extraTabs` lane should layer additional verbs over this base interface in
|
|
8
8
|
* their own ICompilerService subtype.
|
|
9
|
+
*
|
|
10
|
+
* @evidence contracts/common.md#principled-implementation Promise-returning install, compile, bundle and lint verbs express the asynchronous Worker RPC boundary and their distinct result shapes.
|
|
11
|
+
* @evidence contracts/common.md#clear-and-simple-design One base RPC interface separates worker capabilities from React state and site-specific extensions.
|
|
12
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Extensions use a typed service boundary instead of replacing Worker or compiler internals.
|
|
13
|
+
* @evidence contracts/common.md#meaningful-documentation Native paragraphs document both RPC ends and extension ownership; member comments describe transform order and disabled lint behavior under the documentation skill.
|
|
9
14
|
*/
|
|
10
15
|
export interface ICompilerService {
|
|
11
16
|
/**
|
|
12
17
|
* Mount external npm package files into the worker's MemFS under
|
|
13
|
-
* `node_modules/`.
|
|
14
|
-
*
|
|
18
|
+
* `node_modules/`. The package's dependency installer supplies these files.
|
|
19
|
+
*
|
|
20
|
+
* @evidence contracts/common.md#principled-implementation Package-relative file keys and metadata produce a virtual mount report; the Worker serializes installation with compilation.
|
|
21
|
+
* @evidence contracts/common.md#clear-and-simple-design This verb owns mounting while registry fetching stays on the caller side.
|
|
22
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Writes use the virtual-host boundary without bypassing path validation for known packages.
|
|
23
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose states the virtual node_modules namespace and caller responsibility, with tag separation under the documentation skill.
|
|
15
24
|
*/
|
|
16
25
|
installDependencies(props: ICompilerService.IInstallDependenciesProps): Promise<ICompilerService.IInstallDependenciesResult>;
|
|
17
26
|
/**
|
|
18
27
|
* Compile the user's source into JavaScript with diagnostics. Plugin
|
|
19
28
|
* transforms (typia, when enabled in options) run first; the result is the
|
|
20
29
|
* post-transform emit.
|
|
30
|
+
*
|
|
31
|
+
* @evidence contracts/common.md#principled-implementation A discriminated result distinguishes usable emit, compiler findings and operational failure after configured transforms.
|
|
32
|
+
* @evidence contracts/common.md#clear-and-simple-design The verb takes source and per-call flags; factory configuration owns runtime and plugins.
|
|
33
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Configured transform failures remain errors rather than claiming untransformed output fulfills the transform request.
|
|
34
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose states transform-before-emit ordering with tag separation under the documentation skill.
|
|
21
35
|
*/
|
|
22
36
|
compile(props: ICompilerService.IProps): Promise<ICompilerService.IResult>;
|
|
23
37
|
/**
|
|
24
38
|
* Same pipeline as `compile`, but using the bundle-flavored tsconfig
|
|
25
39
|
* (typically `module: "CommonJS"` for in-page `new Function` sandboxing).
|
|
26
40
|
* Sites that don't run user code may treat this identically to `compile`.
|
|
41
|
+
*
|
|
42
|
+
* @evidence contracts/common.md#principled-implementation The bundle verb uses the execution-oriented module configuration but shares the same compile result distinctions.
|
|
43
|
+
* @evidence contracts/common.md#clear-and-simple-design A separate named RPC verb exposes execution emit without requiring clients to supply compiler configuration.
|
|
44
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Module format is explicit supported behavior, not a special case based on the user's source.
|
|
45
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose distinguishes this module shape from preview compile, with tag separation under the documentation skill.
|
|
27
46
|
*/
|
|
28
47
|
bundle(props: ICompilerService.IProps): Promise<ICompilerService.IResult>;
|
|
29
48
|
/**
|
|
30
49
|
* Run the lint plugin and parse its findings into the same diagnostic shape
|
|
31
50
|
* as `compile`. Returns an empty list when no lint plugin is wired into the
|
|
32
51
|
* worker.
|
|
52
|
+
*
|
|
53
|
+
* @evidence contracts/common.md#principled-implementation A diagnostic list carries lint findings; disabled integration legitimately has no findings while operational failures are represented as error diagnostics.
|
|
54
|
+
* @evidence contracts/common.md#clear-and-simple-design Lint owns findings independently of emit and execution results.
|
|
55
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts A failed configured linter cannot masquerade as the documented disabled-linter empty result.
|
|
56
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose documents findings and absent integration, separated from tags under the documentation skill.
|
|
33
57
|
*/
|
|
34
58
|
lint(props: ICompilerService.IProps): Promise<ICompilerService.ILintResult>;
|
|
35
59
|
}
|
|
36
60
|
export declare namespace ICompilerService {
|
|
61
|
+
/**
|
|
62
|
+
* Per-call source and transform enablement; omitted flags use service
|
|
63
|
+
* defaults.
|
|
64
|
+
*
|
|
65
|
+
* @evidence contracts/common.md#principled-implementation Text and optional flags capture the complete per-call input without embedding factory runtime identity.
|
|
66
|
+
* @evidence contracts/common.md#clear-and-simple-design Compile, bundle and lint share one input record rather than duplicate source policy.
|
|
67
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Flags use the declared plugin boundary rather than source-specific dispatch exceptions.
|
|
68
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose defines per-call and omitted-option meaning with tag separation under the documentation skill.
|
|
69
|
+
*/
|
|
37
70
|
export interface IProps {
|
|
38
71
|
source: string;
|
|
39
72
|
options?: ITransformOptions;
|
|
40
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Text files and package identities submitted as one virtual installation.
|
|
76
|
+
*
|
|
77
|
+
* @evidence contracts/common.md#principled-implementation Relative file keys identify writes and the package array labels that operation's metadata; this is not a registry graph solver.
|
|
78
|
+
* @evidence contracts/common.md#clear-and-simple-design Files and identities stay in one RPC payload while result counts are a separate response.
|
|
79
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Virtual installation uses caller-supplied entries and the host's path gate, not fixture-specific package logic.
|
|
80
|
+
* @evidence contracts/common.md#meaningful-documentation Member prose defines relative keys and metadata association with blank member lines under the documentation skill.
|
|
81
|
+
*/
|
|
41
82
|
export interface IInstallDependenciesProps {
|
|
42
83
|
/** Node_modules-relative paths to text content. */
|
|
43
84
|
files: Record<string, string>;
|
|
44
85
|
/** Metadata for the packages whose files are in `files`. */
|
|
45
86
|
packages: IInstalledPackage[];
|
|
46
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Exposed package name and exact installed version for a mounting report.
|
|
90
|
+
*
|
|
91
|
+
* @evidence contracts/common.md#principled-implementation Name and version label the mounted package; registry alias identity and active constraints belong to the dependency solver's richer type.
|
|
92
|
+
* @evidence contracts/common.md#clear-and-simple-design The mounting report carries only the identity its client needs.
|
|
93
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The record reports supplied metadata and does not infer compatibility from a name alone.
|
|
94
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose distinguishes mount metadata from solver state, with tags separated under the documentation skill.
|
|
95
|
+
*/
|
|
47
96
|
export interface IInstalledPackage {
|
|
48
97
|
name: string;
|
|
49
98
|
version: string;
|
|
50
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Submitted package identities and count of accepted virtual-file writes.
|
|
102
|
+
*
|
|
103
|
+
* @evidence contracts/common.md#principled-implementation fileCount counts writes accepted by path validation; installed carries the submitted identities rather than asserting a solved dependency graph.
|
|
104
|
+
* @evidence contracts/common.md#clear-and-simple-design A small mounting response separates accepted-write count from compile output.
|
|
105
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Counts arise from actual writes rather than expected answers or skipped malformed paths.
|
|
106
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose defines counting and metadata limits with tag separation under the documentation skill.
|
|
107
|
+
*/
|
|
51
108
|
export interface IInstallDependenciesResult {
|
|
52
109
|
installed: IInstalledPackage[];
|
|
53
110
|
fileCount: number;
|
|
54
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Compile outcome discriminated by successful emit, findings or operation
|
|
114
|
+
* error.
|
|
115
|
+
*
|
|
116
|
+
* @evidence contracts/common.md#principled-implementation The type field discriminates string emit from unknown error payload; failure retains both emit and diagnostics.
|
|
117
|
+
* @evidence contracts/common.md#clear-and-simple-design Named variants centralize result narrowing across Worker and UI.
|
|
118
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Operational errors are a distinct variant rather than fabricated successful text.
|
|
119
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose names all outcome meanings with tag separation under the documentation skill.
|
|
120
|
+
*/
|
|
55
121
|
export type IResult = ISuccess | IFailure | IError;
|
|
122
|
+
/**
|
|
123
|
+
* JavaScript emit with no error diagnostics; empty text may mean no emitted
|
|
124
|
+
* file.
|
|
125
|
+
*
|
|
126
|
+
* @evidence contracts/common.md#principled-implementation The success discriminant and string payload represent the compile lane's non-error outcome.
|
|
127
|
+
* @evidence contracts/common.md#clear-and-simple-design The common envelope is reused without an unnecessary second success structure.
|
|
128
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Success does not claim that empty emit proves a file exists or user code is safe.
|
|
129
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose explains the empty-emit limit with tag separation under the documentation skill.
|
|
130
|
+
*/
|
|
56
131
|
export interface ISuccess extends IBase<"success", string> {
|
|
57
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Compiler findings together with any available JavaScript emit.
|
|
135
|
+
*
|
|
136
|
+
* @evidence contracts/common.md#principled-implementation Error findings accompany a string emit payload so the UI can show both even when compilation is unsuccessful.
|
|
137
|
+
* @evidence contracts/common.md#clear-and-simple-design Only the finding variant adds diagnostics to the shared envelope.
|
|
138
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Findings remain explicit rather than converting nonempty emit into unconditional success.
|
|
139
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose defines simultaneous diagnostics and emit with tag separation under the documentation skill.
|
|
140
|
+
*/
|
|
58
141
|
export interface IFailure extends IBase<"failure", string> {
|
|
59
142
|
diagnostics: IDiagnostic[];
|
|
60
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Operation failure whose transport payload may be an error record or
|
|
146
|
+
* message.
|
|
147
|
+
*
|
|
148
|
+
* @evidence contracts/common.md#principled-implementation Unknown preserves the permitted error payload domain until the receiver normalizes it.
|
|
149
|
+
* @evidence contracts/common.md#clear-and-simple-design The error discriminant shares routing fields with other outcomes without pretending its payload is JavaScript.
|
|
150
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Failures retain their own outcome rather than inventing emit to satisfy consumers.
|
|
151
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose explains payload variability with tag separation under the documentation skill.
|
|
152
|
+
*/
|
|
61
153
|
export interface IError extends IBase<"error", unknown> {
|
|
62
154
|
}
|
|
63
155
|
interface IBase<Type extends string, Value> {
|
|
@@ -65,6 +157,15 @@ export declare namespace ICompilerService {
|
|
|
65
157
|
target: "javascript";
|
|
66
158
|
value: Value;
|
|
67
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* UI diagnostic with one-based location and a span measured in source
|
|
162
|
+
* characters.
|
|
163
|
+
*
|
|
164
|
+
* @evidence contracts/common.md#principled-implementation Location, severity, text and optional code represent compiler and lint findings without tying them to one producer.
|
|
165
|
+
* @evidence contracts/common.md#clear-and-simple-design One diagnostic shape is shared by compile and lint result lanes.
|
|
166
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Producer codes are carried as metadata rather than hardcoded finding decisions.
|
|
167
|
+
* @evidence contracts/common.md#meaningful-documentation Member JSDoc defines coordinate bases, span units and code purpose, with documentation-skill member spacing.
|
|
168
|
+
*/
|
|
68
169
|
export interface IDiagnostic {
|
|
69
170
|
/** 1-based line number. */
|
|
70
171
|
line: number;
|
|
@@ -77,6 +178,15 @@ export declare namespace ICompilerService {
|
|
|
77
178
|
/** Diagnostic code, e.g. `"TS2322"` or a lint rule id. */
|
|
78
179
|
code?: string;
|
|
79
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Lint findings, including an error diagnostic when the configured plugin
|
|
183
|
+
* fails.
|
|
184
|
+
*
|
|
185
|
+
* @evidence contracts/common.md#principled-implementation A diagnostic array covers both rule findings and plugin failure reports; absence of configured lint yields an empty array.
|
|
186
|
+
* @evidence contracts/common.md#clear-and-simple-design The lint lane returns findings without unrelated JavaScript output fields.
|
|
187
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Configured-plugin failure is kept visible rather than encoded as a clean empty list.
|
|
188
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose states failure representation with tag separation under the documentation skill.
|
|
189
|
+
*/
|
|
80
190
|
export interface ILintResult {
|
|
81
191
|
diagnostics: IDiagnostic[];
|
|
82
192
|
}
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
* `console.log(...args)`), so `console.log("user:", user)` shows up as a single
|
|
4
4
|
* row with both pieces rendered inline, separated by a space — same as a real
|
|
5
5
|
* DevTools console.
|
|
6
|
+
*
|
|
7
|
+
* @evidence contracts/common.md#principled-implementation The finite console-method union labels one captured invocation; unknown arguments preserve values without pretending every value is serializable.
|
|
8
|
+
* @evidence contracts/common.md#clear-and-simple-design Method and argument list keep event identity separate from renderer policy.
|
|
9
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Console labels are supported invocation kinds, not special cases for particular user output.
|
|
10
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose explains argument grouping and display meaning in a separate paragraph under the documentation skill.
|
|
6
11
|
*/
|
|
7
12
|
export interface IConsoleMessage {
|
|
8
13
|
type: "debug" | "dir" | "error" | "info" | "log" | "table" | "warn";
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Options for {@link createCompilerClient}.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/common.md#principled-implementation A script URL is the input accepted by the tgrid Worker connector; this type does not advertise unsupported Worker construction options.
|
|
5
|
+
* @evidence contracts/common.md#clear-and-simple-design The single client input stays distinct from worker-side compiler configuration.
|
|
6
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Worker creation uses tgrid's supported URL boundary instead of replacing its internals.
|
|
7
|
+
* @evidence contracts/common.md#meaningful-documentation The member comment explains script ownership and classic Worker constraints, following documentation-skill prose separation.
|
|
8
|
+
*/
|
|
2
9
|
export interface ICreateCompilerClientOptions {
|
|
3
10
|
/**
|
|
4
11
|
* URL of the bundled worker script (the site's rspack output of its
|
|
5
12
|
* `compiler/index.ts` worker entry, which calls `createWorkerCompiler`).
|
|
6
13
|
*
|
|
7
|
-
* The Worker is constructed by tgrid's `WorkerConnector` with classic
|
|
14
|
+
* The Worker is constructed by tgrid's `WorkerConnector` with classic Worker
|
|
8
15
|
* semantics. A custom Worker factory hook is intentionally not exposed — the
|
|
9
16
|
* upstream tgrid v1 API only accepts a URL. File an issue if you need module
|
|
10
17
|
* workers, named workers, or custom credentials.
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { ILintPluginConfig } from "./ILintPluginConfig";
|
|
2
2
|
import type { ITypiaPluginConfig } from "./ITypiaPluginConfig";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Options for {@link createWorkerCompiler}.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/common.md#principled-implementation Required runtime identity and optional virtual-project paths express boot and compilation inputs; false distinguishes disabled integrations from default integration settings.
|
|
7
|
+
* @evidence contracts/common.md#clear-and-simple-design Boot inputs, virtual layout and plugin options remain one explicit factory record with nested plugin responsibilities.
|
|
8
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Plugin names and defaults describe the supported playground integrations; sites override them through explicit configuration.
|
|
9
|
+
* @evidence contracts/common.md#meaningful-documentation Member JSDoc explains defaults, registration identity and compiler-option ownership, with blank member lines following the documentation skill.
|
|
10
|
+
*/
|
|
4
11
|
export interface ICreateWorkerCompilerOptions {
|
|
5
12
|
/** URL of the site's pre-built playground.wasm. */
|
|
6
13
|
wasmUrl: string;
|
|
@@ -28,8 +35,9 @@ export interface ICreateWorkerCompilerOptions {
|
|
|
28
35
|
/**
|
|
29
36
|
* Extra entries spliced into the tsconfig's `compilerOptions`. Use to wire
|
|
30
37
|
* site-specific plugins, paths, or lib overrides. The typia plugin entry is
|
|
31
|
-
* appended automatically
|
|
32
|
-
* include it
|
|
38
|
+
* appended automatically after any `plugins` array given here when
|
|
39
|
+
* `typiaPlugin` is enabled — sites should NOT include it themselves, and an
|
|
40
|
+
* entry naming the same transform module is replaced by the appended one.
|
|
33
41
|
*/
|
|
34
42
|
extraCompilerOptions?: Record<string, unknown>;
|
|
35
43
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import type { PlaygroundFetch } from "./IPlaygroundDependencyInstallOptions";
|
|
1
2
|
/**
|
|
2
3
|
* Options for {@link installTypiaSourcePack} and
|
|
3
4
|
* {@link createTypiaSourcePackMount}.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/common.md#principled-implementation URL, virtual mount root, abort signal and fetch injection represent independent transport and installation inputs.
|
|
7
|
+
* @evidence contracts/common.md#clear-and-simple-design One shared record serves the mount adapter and installer without a second transport configuration model.
|
|
8
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Transport injection is explicit; callers need not monkey-patch global fetch to load a pack.
|
|
9
|
+
* @evidence contracts/common.md#meaningful-documentation Member prose explains virtual root defaults and shared cancellation, with native paragraphs and spacing from the documentation skill.
|
|
4
10
|
*/
|
|
5
11
|
export interface IInstallTypiaSourcePackOptions {
|
|
6
12
|
/** URL the site serves the pre-built typia source pack from. */
|
|
@@ -16,5 +22,5 @@ export interface IInstallTypiaSourcePackOptions {
|
|
|
16
22
|
* Optional fetcher. Defaults to `globalThis.fetch`. Override for tests or for
|
|
17
23
|
* sites that want their own caching strategy.
|
|
18
24
|
*/
|
|
19
|
-
fetch?:
|
|
25
|
+
fetch?: PlaygroundFetch;
|
|
20
26
|
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Options for the `@ttsc/lint` integration of {@link createWorkerCompiler}.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/common.md#principled-implementation An optional registration name selects the host's lint verb without conflating its identity with enablement.
|
|
5
|
+
* @evidence contracts/common.md#clear-and-simple-design The record contains only the integration-owned name; factory options own disabling the integration.
|
|
6
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The default id is a registered product integration and remains caller-configurable.
|
|
7
|
+
* @evidence contracts/common.md#meaningful-documentation Native comments identify registration ownership and the default id, with prose separated from tags under the documentation skill.
|
|
8
|
+
*/
|
|
2
9
|
export interface ILintPluginConfig {
|
|
3
10
|
/** Plugin id registered with `host.Expose` (default: `"@ttsc/lint"`). */
|
|
4
11
|
name?: string;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Cancellation policy for `loadTypiaRuntimePack`.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/common.md#principled-implementation Optional AbortSignal carries the caller's cancellation request without imposing a fabricated network deadline.
|
|
5
|
+
* @evidence contracts/common.md#clear-and-simple-design Runtime URL is the loader's direct argument; this record contains only cancellation policy.
|
|
6
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Shared cancellation is an explicit supported behavior, not a hidden timeout or global replacement.
|
|
7
|
+
* @evidence contracts/common.md#meaningful-documentation The member comment states that cancellation ends the shared attempt, following native documentation and tag separation rules.
|
|
8
|
+
*/
|
|
2
9
|
export interface ILoadTypiaRuntimePackOptions {
|
|
3
10
|
/** Cancel the shared in-flight load. */
|
|
4
11
|
signal?: AbortSignal;
|
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
* Sites declare these for whatever transform plugins their wasm registered; the
|
|
5
5
|
* panel renders one row per entry and bubbles `onChange` with the merged
|
|
6
6
|
* options object.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/common.md#principled-implementation The key identifies a boolean option while label and description supply its visible presentation.
|
|
9
|
+
* @evidence contracts/common.md#clear-and-simple-design Rendering metadata stays separate from plugin execution and current option values.
|
|
10
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Site-provided keys drive the panel instead of consumer-specific option branches.
|
|
11
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose explains site ownership and option merging in separated paragraphs following the documentation skill.
|
|
7
12
|
*/
|
|
8
13
|
export interface IOptionToggle {
|
|
9
14
|
key: string;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type { IPlaygroundDependencyProgress } from "./IPlaygroundDependencyProgress";
|
|
2
2
|
import type { IPlaygroundInstalledDependency } from "./IPlaygroundInstalledDependency";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Options for {@link installPlaygroundDependencies}.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/common.md#principled-implementation Mounted exact identities, ignore policy, budgets and callbacks express distinct installation inputs; deprecated name-only state cannot establish version compatibility.
|
|
7
|
+
* @evidence contracts/common.md#clear-and-simple-design One installation record groups transport, prior graph and progress controls without owning compiler mounting.
|
|
8
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Fetch injection and explicit built-in exclusions are public policy; byte and package budgets apply to every package.
|
|
9
|
+
* @evidence contracts/common.md#meaningful-documentation Member prose documents legacy limitations, byte units and streaming enforcement, with separate paragraphs and member spacing under the documentation skill.
|
|
10
|
+
*/
|
|
4
11
|
export interface IPlaygroundDependencyInstallOptions {
|
|
5
|
-
/** Defaults to `globalThis.fetch
|
|
6
|
-
fetch?:
|
|
12
|
+
/** Defaults to `globalThis.fetch`; inject a transport for offline runs. */
|
|
13
|
+
fetch?: PlaygroundFetch;
|
|
7
14
|
/**
|
|
8
15
|
* Exact package identities already mounted in this session.
|
|
9
16
|
*
|
|
@@ -19,7 +26,14 @@ export interface IPlaygroundDependencyInstallOptions {
|
|
|
19
26
|
installedPackages?: Iterable<string>;
|
|
20
27
|
/** Package names to never install (preinstalled / built-in). */
|
|
21
28
|
ignoredPackages?: Iterable<string>;
|
|
22
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Maximum distinct package names completed in one install call (default: 48).
|
|
31
|
+
*
|
|
32
|
+
* Must be a nonnegative safe integer. Mounted packages revalidated and
|
|
33
|
+
* optional packages omitted count toward the cap; unrequested mounted state
|
|
34
|
+
* does not. Zero allows only calls with no queued packages. Invalid values
|
|
35
|
+
* reject before input iteration, progress callbacks or network requests.
|
|
36
|
+
*/
|
|
23
37
|
maxPackages?: number;
|
|
24
38
|
/**
|
|
25
39
|
* Maximum compressed bytes accepted for one npm tarball.
|
|
@@ -36,6 +50,27 @@ export interface IPlaygroundDependencyInstallOptions {
|
|
|
36
50
|
maxUnpackedBytes?: number;
|
|
37
51
|
/** Aborts the install when triggered. */
|
|
38
52
|
signal?: AbortSignal;
|
|
39
|
-
/**
|
|
40
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Fires synchronously for phase transitions; callback failures reject the
|
|
55
|
+
* install.
|
|
56
|
+
*/
|
|
57
|
+
onProgress?: PlaygroundDependencyProgressHandler;
|
|
41
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Fetch a playground package or source pack through the caller's transport.
|
|
61
|
+
*
|
|
62
|
+
* @evidence contracts/common.md#principled-implementation Standard RequestInit and Response preserve status, cancellation and streamed-body semantics used by the loaders.
|
|
63
|
+
* @evidence contracts/common.md#clear-and-simple-design Transport stays distinct from registry resolution, archive processing and mounting.
|
|
64
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Injection uses an explicit seam without replacing global fetch internals.
|
|
65
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose identifies the transport role; optional initialization matches fetch consumers.
|
|
66
|
+
*/
|
|
67
|
+
export type PlaygroundFetch = (input: string, init?: RequestInit) => Promise<Response>;
|
|
68
|
+
/**
|
|
69
|
+
* Receive synchronous installation progress; thrown errors reject installation.
|
|
70
|
+
*
|
|
71
|
+
* @evidence contracts/common.md#principled-implementation A typed event reports the actual install transition without inventing a success result.
|
|
72
|
+
* @evidence contracts/common.md#clear-and-simple-design A single void notification keeps presentation state outside registry processing.
|
|
73
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Observer failures are not converted into synthetic installation success.
|
|
74
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose states delivery timing and error propagation independently of acknowledgment tags.
|
|
75
|
+
*/
|
|
76
|
+
export type PlaygroundDependencyProgressHandler = (event: IPlaygroundDependencyProgress) => void;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { IPlaygroundDependencyPackage } from "./IPlaygroundDependencyPackage";
|
|
2
2
|
import type { IPlaygroundInstalledDependency } from "./IPlaygroundInstalledDependency";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Aggregate result returned by {@link installPlaygroundDependencies}.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/common.md#principled-implementation Exact identities describe the complete graph while downloaded package metadata and file maps describe this call's additions in each consumer's namespace.
|
|
7
|
+
* @evidence contracts/common.md#clear-and-simple-design Compiler, editor and runtime maps remain explicit lanes instead of requiring consumers to infer path spelling.
|
|
8
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Output namespaces represent actual consumer protocols rather than special casing a package or source example.
|
|
9
|
+
* @evidence contracts/common.md#meaningful-documentation Member prose distinguishes complete state from new downloads and documents each map's path namespace, with documentation-skill member spacing.
|
|
10
|
+
*/
|
|
4
11
|
export interface IPlaygroundDependencyInstallResult {
|
|
5
12
|
/** Complete exact state after merging installed packages with this call. */
|
|
6
13
|
resolvedDependencies: IPlaygroundInstalledDependency[];
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Metadata for one successfully installed npm package; counts refer to mounted
|
|
3
|
+
* text files and declaration files, respectively.
|
|
4
|
+
*
|
|
5
|
+
* @evidence contracts/common.md#principled-implementation Mount name, registry identity and exact version distinguish aliases from their targets; counts describe the installed artifact population.
|
|
6
|
+
* @evidence contracts/common.md#clear-and-simple-design Artifact metadata is separate from active dependency constraints and the downloaded file maps.
|
|
7
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Registry identity is explicit rather than inferred from an alias's exposed name.
|
|
8
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose defines count meaning and the registryName distinction, with separate tags under the documentation skill.
|
|
9
|
+
*/
|
|
2
10
|
export interface IPlaygroundDependencyPackage {
|
|
3
11
|
name: string;
|
|
4
12
|
/** Package name queried from the registry, which differs for npm aliases. */
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { IPlaygroundDependencyProgressPhase } from "./IPlaygroundDependencyProgressPhase";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* One dependency-install progress event. Package identity may be absent for
|
|
4
|
+
* aggregate completion; completed and total count package work, not bytes.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/common.md#principled-implementation Phase and optional package identity express both per-package transitions and aggregate completion without inventing an identity for the latter.
|
|
7
|
+
* @evidence contracts/common.md#clear-and-simple-design One event record carries display progress without exposing the installer's queue internals.
|
|
8
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Progress reflects actual phase transitions and package counts, not fabricated measurement outcomes.
|
|
9
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose states optional identity and count units; paragraph and tag separation follow the documentation skill.
|
|
10
|
+
*/
|
|
3
11
|
export interface IPlaygroundDependencyProgress {
|
|
4
12
|
phase: IPlaygroundDependencyProgressPhase;
|
|
5
13
|
packageName?: string;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Lifecycle phase of
|
|
3
|
-
*
|
|
2
|
+
* Lifecycle phase of dependency installation. `done` can describe one package
|
|
3
|
+
* or the completed install; the shell reports `error` when installation fails.
|
|
4
|
+
*
|
|
5
|
+
* @evidence contracts/common.md#principled-implementation The finite union represents queued, transport, extraction and terminal reporting phases shared by the installer and shell.
|
|
6
|
+
* @evidence contracts/common.md#clear-and-simple-design A named phase union lets event consumers share labels without depending on installer control flow.
|
|
7
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Phase constants are supported progress states rather than package-specific cases.
|
|
8
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose distinguishes per-package phases from aggregate completion, with tag separation following the documentation skill.
|
|
4
9
|
*/
|
|
5
10
|
export type IPlaygroundDependencyProgressPhase = "queued" | "resolve" | "download" | "extract" | "skip" | "error" | "done";
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* One active npm range that selected a mounted playground dependency.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/common.md#principled-implementation Range, requester and optionality preserve the constraint and its origin so mounted-version compatibility can be assessed.
|
|
5
|
+
* @evidence contracts/common.md#clear-and-simple-design A constraint record separates dependency edges from mounted package identity.
|
|
6
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Optionality explicitly permits omission; a missing required edge is not disguised as successful reuse.
|
|
7
|
+
* @evidence contracts/common.md#meaningful-documentation Member JSDoc explains declared range, origin and omission meaning, following documentation-skill member spacing.
|
|
8
|
+
*/
|
|
2
9
|
export interface IPlaygroundDependencyRequest {
|
|
3
10
|
/** Declared npm range or tag. */
|
|
4
11
|
range: string;
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
* One pre-canned source script the playground dropdown can load. Sites provide
|
|
3
3
|
* their own list — typia's site lists `random/is/json/protobuf`, the ttsc site
|
|
4
4
|
* lists `typia/lint/mixed`.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/common.md#principled-implementation Stable id selects source independently of visible title and optional grouping metadata.
|
|
7
|
+
* @evidence contracts/common.md#clear-and-simple-design Example content and presentation stay in a site-owned record without compiler configuration mixed in.
|
|
8
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Sites supply examples; ids do not choose hidden compiler behavior.
|
|
9
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose identifies site ownership and the group default, following documentation-skill paragraph and tag separation.
|
|
5
10
|
*/
|
|
6
11
|
export interface IPlaygroundExample {
|
|
7
12
|
id: string;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { IPlaygroundDependencyRequest } from "./IPlaygroundDependencyRequest";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Exact identity and active constraints of one dependency already mounted.
|
|
4
|
+
*
|
|
5
|
+
* @evidence contracts/common.md#principled-implementation Mount name, registry name, exact version and active requests jointly represent the installed graph's compatibility witness.
|
|
6
|
+
* @evidence contracts/common.md#clear-and-simple-design Identity and its selecting constraints remain one record while artifact contents belong to result maps.
|
|
7
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Explicit exact identities replace name-only guesses about whether later requests are satisfied.
|
|
8
|
+
* @evidence contracts/common.md#meaningful-documentation Member comments distinguish exposed name, alias target, exact version and requests, with documentation-skill member spacing.
|
|
9
|
+
*/
|
|
3
10
|
export interface IPlaygroundInstalledDependency {
|
|
4
11
|
/** Exposed package name under `node_modules`. */
|
|
5
12
|
name: string;
|
|
@@ -8,6 +8,11 @@ import type { ITransformOptions } from "./ITransformOptions";
|
|
|
8
8
|
* The shell is intentionally configurable rather than configurable-by-context:
|
|
9
9
|
* every changing field is an explicit prop, so wrappers can spread their own
|
|
10
10
|
* defaults without a Provider in between.
|
|
11
|
+
*
|
|
12
|
+
* @evidence contracts/common.md#principled-implementation Site-owned runtime URL, initial content, presentation and execution policy distinguish required inputs from optional UI features.
|
|
13
|
+
* @evidence contracts/common.md#clear-and-simple-design Explicit props keep site policy outside shell lifecycle implementation; option metadata and example records have their own types.
|
|
14
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Site policy enters through declared props and callbacks rather than consumer-specific branches.
|
|
15
|
+
* @evidence contracts/common.md#meaningful-documentation Member prose explains defaults, runtime-file namespace and cancellation limits, with documentation-skill paragraphs and member spacing.
|
|
11
16
|
*/
|
|
12
17
|
export interface IPlaygroundShellProps {
|
|
13
18
|
/**
|
|
@@ -30,39 +35,39 @@ export interface IPlaygroundShellProps {
|
|
|
30
35
|
defaultOptions?: ITransformOptions;
|
|
31
36
|
/**
|
|
32
37
|
* Static extra .d.ts entries to mount in Monaco (e.g. a pre-packed typia type
|
|
33
|
-
* pack). Merged with dependencies installed at runtime.
|
|
38
|
+
* pack). Merged with dependencies installed at runtime. Keep the object
|
|
39
|
+
* identity stable across renders: a new object makes the editor dispose and
|
|
40
|
+
* register every declaration again.
|
|
34
41
|
*/
|
|
35
42
|
staticEditorLibs?: Record<string, string>;
|
|
36
43
|
/**
|
|
37
44
|
* Packages the site has already pre-mounted into the wasm. These are skipped
|
|
38
|
-
* by the runtime npm dependency installer.
|
|
45
|
+
* by the runtime npm dependency installer. Keep the array identity stable
|
|
46
|
+
* across renders: a new array restarts the pending compile debounce.
|
|
39
47
|
*/
|
|
40
48
|
preinstalledPackages?: readonly string[];
|
|
41
49
|
/**
|
|
42
50
|
* Optional execute hook. When provided, the shell renders an "Execute"
|
|
43
51
|
* button; on click it calls `service.bundle(...)` to get the JS and passes it
|
|
44
|
-
* here.
|
|
52
|
+
* here. Calls the hook makes on `sandbox.console` are appended to the Console
|
|
53
|
+
* pane in order; its returned promise carries no messages.
|
|
45
54
|
*
|
|
46
|
-
* `sandbox.runtimeFiles` is the
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
55
|
+
* `sandbox.runtimeFiles` is the current runtime-file map produced by
|
|
56
|
+
* dependency installation in this session (package-rooted keys like
|
|
57
|
+
* `uuid/dist/index.js`). The site's executeBundle typically merges these on
|
|
58
|
+
* top of its own typia-runtime pack and feeds the union to
|
|
59
|
+
* `createSandboxRequire` — without this channel the in-page Execute sandbox
|
|
60
|
+
* cannot resolve any npm dependency the user installed.
|
|
52
61
|
*
|
|
53
62
|
* `sandbox.signal` aborts when source or compiler options change, a newer
|
|
54
|
-
* Execute starts, or the shell unmounts.
|
|
55
|
-
* to cancellable setup such as
|
|
56
|
-
* user code cannot be preempted
|
|
57
|
-
* untrusted code is accepted.
|
|
63
|
+
* Execute starts, the compiler Worker is replaced, or the shell unmounts.
|
|
64
|
+
* Implementations must pass it through to cancellable setup such as
|
|
65
|
+
* runtime-pack fetches. Synchronous evaluated user code cannot be preempted
|
|
66
|
+
* and still requires an isolated executor when untrusted code is accepted.
|
|
58
67
|
*
|
|
59
68
|
* When omitted, the Execute UI is hidden.
|
|
60
69
|
*/
|
|
61
|
-
executeBundle?:
|
|
62
|
-
console: Record<string, (...args: unknown[]) => void>;
|
|
63
|
-
runtimeFiles: Record<string, string>;
|
|
64
|
-
signal: AbortSignal;
|
|
65
|
-
}) => Promise<void>;
|
|
70
|
+
executeBundle?: PlaygroundBundleExecutor;
|
|
66
71
|
/**
|
|
67
72
|
* Brand slot in the toolbar (left side). Renders before the Playground label.
|
|
68
73
|
* Sites typically pass `<a href="/">SiteName</a>`.
|
|
@@ -73,5 +78,34 @@ export interface IPlaygroundShellProps {
|
|
|
73
78
|
* Defaults to `"dist/playground.js"`. Receives the current transform options
|
|
74
79
|
* so sites can append `· typia disabled` etc.
|
|
75
80
|
*/
|
|
76
|
-
resultCaption?:
|
|
81
|
+
resultCaption?: PlaygroundResultCaption;
|
|
77
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Execute emitted code with session runtime files and attempt-scoped
|
|
85
|
+
* cancellation.
|
|
86
|
+
*
|
|
87
|
+
* The site owns execution isolation. The abort signal can cancel asynchronous
|
|
88
|
+
* setup, but cannot preempt synchronous evaluated code.
|
|
89
|
+
*
|
|
90
|
+
* @evidence contracts/common.md#principled-implementation Emitted code, package-rooted runtime files and cancellation preserve the shell's real execution inputs and isolation boundary.
|
|
91
|
+
* @evidence contracts/common.md#clear-and-simple-design One asynchronous hook keeps site execution policy separate from bundling, console presentation and compiler Worker ownership.
|
|
92
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts A declared hook permits site-owned isolation without patching foreign runtime behavior.
|
|
93
|
+
* @evidence contracts/common.md#meaningful-documentation Native paragraphs describe cancellation limits and ownership before the acknowledgment tags.
|
|
94
|
+
*/
|
|
95
|
+
export type PlaygroundBundleExecutor = (code: string, sandbox: {
|
|
96
|
+
/** Console methods supplied by the shell for this execution attempt. */
|
|
97
|
+
console: Record<string, (...args: unknown[]) => void>;
|
|
98
|
+
/** Package-rooted runtime modules in the current dependency graph. */
|
|
99
|
+
runtimeFiles: Record<string, string>;
|
|
100
|
+
/** Cancellation for setup and asynchronous work, not synchronous user code. */
|
|
101
|
+
signal: AbortSignal;
|
|
102
|
+
}) => Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* Choose a result-pane caption from current transform options.
|
|
105
|
+
*
|
|
106
|
+
* @evidence contracts/common.md#principled-implementation Current options select presentation text only, without claiming to select emitted filenames.
|
|
107
|
+
* @evidence contracts/common.md#clear-and-simple-design A string-returning presentation callback stays independent of compiler configuration.
|
|
108
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts A caption is a UI label rather than evidence that a particular output was produced.
|
|
109
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose identifies the display purpose and parameter before the separated tags.
|
|
110
|
+
*/
|
|
111
|
+
export type PlaygroundResultCaption = (options: ITransformOptions) => string;
|
|
@@ -3,10 +3,16 @@
|
|
|
3
3
|
* typically the typia `.d.ts` pack and any installed npm package `.d.ts` files
|
|
4
4
|
* — and the editor mounts them via
|
|
5
5
|
* `monaco.languages.typescript.typescriptDefaults.addExtraLib`.
|
|
6
|
+
*
|
|
7
|
+
* @evidence contracts/common.md#principled-implementation Controlled text, change callback, model URI and optional declaration map describe Monaco's input boundaries.
|
|
8
|
+
* @evidence contracts/common.md#clear-and-simple-design Editor props contain editing and virtual-library inputs without compiler lifecycle state.
|
|
9
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Declaration installation uses Monaco's supported extra-lib API rather than mutating editor internals.
|
|
10
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose explains map identity replacement and default URI, with separated paragraphs and member spacing under the documentation skill.
|
|
6
11
|
*/
|
|
7
12
|
export interface ISourceEditorProps {
|
|
8
13
|
value: string;
|
|
9
|
-
|
|
14
|
+
/** Publish the editor's complete current text to the controlling owner. */
|
|
15
|
+
onChange: SourceEditorChangeHandler;
|
|
10
16
|
/**
|
|
11
17
|
* Map of file path → declaration text. Mounted into Monaco's TypeScript
|
|
12
18
|
* extra-libs registry. Hot-replaceable: the editor disposes the previous libs
|
|
@@ -16,3 +22,12 @@ export interface ISourceEditorProps {
|
|
|
16
22
|
/** Editor model URI. Defaults to `file:///src/playground.ts`. */
|
|
17
23
|
path?: string;
|
|
18
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Publish the editor's complete text to its controlling owner.
|
|
27
|
+
*
|
|
28
|
+
* @evidence contracts/common.md#principled-implementation The full-text parameter matches the controlled value model without requiring edit-delta reconstruction.
|
|
29
|
+
* @evidence contracts/common.md#clear-and-simple-design One void notification leaves text state with the parent.
|
|
30
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The supported event boundary avoids mutating parent state or editor globals.
|
|
31
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose names the payload and owner, separated from the acknowledgment tags.
|
|
32
|
+
*/
|
|
33
|
+
export type SourceEditorChangeHandler = (value: string) => void;
|