@ttsc/playground 0.30.4 → 0.31.1
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
|
@@ -1,9 +1,18 @@
|
|
|
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;
|
|
12
|
+
|
|
5
13
|
/** Package or source entry that declared the range. */
|
|
6
14
|
requester: string;
|
|
15
|
+
|
|
7
16
|
/** Whether an unsatisfied request may be omitted. */
|
|
8
17
|
optional: boolean;
|
|
9
18
|
}
|
|
@@ -2,12 +2,18 @@
|
|
|
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;
|
|
8
13
|
title: string;
|
|
9
14
|
description: string;
|
|
10
15
|
source: string;
|
|
16
|
+
|
|
11
17
|
/**
|
|
12
18
|
* Optional grouping bucket. Examples are rendered grouped by this label.
|
|
13
19
|
* Defaults to "Examples" when omitted.
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import type { IPlaygroundDependencyRequest } from "./IPlaygroundDependencyRequest";
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Exact identity and active constraints of one dependency already mounted.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/common.md#principled-implementation Mount name, registry name, exact version and active requests jointly represent the installed graph's compatibility witness.
|
|
7
|
+
* @evidence contracts/common.md#clear-and-simple-design Identity and its selecting constraints remain one record while artifact contents belong to result maps.
|
|
8
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Explicit exact identities replace name-only guesses about whether later requests are satisfied.
|
|
9
|
+
* @evidence contracts/common.md#meaningful-documentation Member comments distinguish exposed name, alias target, exact version and requests, with documentation-skill member spacing.
|
|
10
|
+
*/
|
|
4
11
|
export interface IPlaygroundInstalledDependency {
|
|
5
12
|
/** Exposed package name under `node_modules`. */
|
|
6
13
|
name: string;
|
|
14
|
+
|
|
7
15
|
/** Package name queried from the registry, which differs for npm aliases. */
|
|
8
16
|
registryName: string;
|
|
17
|
+
|
|
9
18
|
/** Exact mounted version. */
|
|
10
19
|
version: string;
|
|
20
|
+
|
|
11
21
|
/** Active requests that the mounted version satisfies. */
|
|
12
22
|
requests: IPlaygroundDependencyRequest[];
|
|
13
23
|
}
|
|
@@ -10,6 +10,11 @@ import type { ITransformOptions } from "./ITransformOptions";
|
|
|
10
10
|
* The shell is intentionally configurable rather than configurable-by-context:
|
|
11
11
|
* every changing field is an explicit prop, so wrappers can spread their own
|
|
12
12
|
* defaults without a Provider in between.
|
|
13
|
+
*
|
|
14
|
+
* @evidence contracts/common.md#principled-implementation Site-owned runtime URL, initial content, presentation and execution policy distinguish required inputs from optional UI features.
|
|
15
|
+
* @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.
|
|
16
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Site policy enters through declared props and callbacks rather than consumer-specific branches.
|
|
17
|
+
* @evidence contracts/common.md#meaningful-documentation Member prose explains defaults, runtime-file namespace and cancellation limits, with documentation-skill paragraphs and member spacing.
|
|
13
18
|
*/
|
|
14
19
|
export interface IPlaygroundShellProps {
|
|
15
20
|
/**
|
|
@@ -23,11 +28,13 @@ export interface IPlaygroundShellProps {
|
|
|
23
28
|
|
|
24
29
|
/** Examples available in the dropdown. Empty array hides the dropdown. */
|
|
25
30
|
examples?: readonly IPlaygroundExample[];
|
|
31
|
+
|
|
26
32
|
/** Display labels for example groups. */
|
|
27
33
|
exampleGroupLabels?: Record<string, string>;
|
|
28
34
|
|
|
29
35
|
/** Toggles rendered in the Options modal. Defaults to typia + lint. */
|
|
30
36
|
optionToggles?: readonly IOptionToggle[];
|
|
37
|
+
|
|
31
38
|
/**
|
|
32
39
|
* Initial values for the transform options. Defaults to `{typia: true, lint:
|
|
33
40
|
* true}`.
|
|
@@ -36,44 +43,41 @@ export interface IPlaygroundShellProps {
|
|
|
36
43
|
|
|
37
44
|
/**
|
|
38
45
|
* Static extra .d.ts entries to mount in Monaco (e.g. a pre-packed typia type
|
|
39
|
-
* pack). Merged with dependencies installed at runtime.
|
|
46
|
+
* pack). Merged with dependencies installed at runtime. Keep the object
|
|
47
|
+
* identity stable across renders: a new object makes the editor dispose and
|
|
48
|
+
* register every declaration again.
|
|
40
49
|
*/
|
|
41
50
|
staticEditorLibs?: Record<string, string>;
|
|
42
51
|
|
|
43
52
|
/**
|
|
44
53
|
* Packages the site has already pre-mounted into the wasm. These are skipped
|
|
45
|
-
* by the runtime npm dependency installer.
|
|
54
|
+
* by the runtime npm dependency installer. Keep the array identity stable
|
|
55
|
+
* across renders: a new array restarts the pending compile debounce.
|
|
46
56
|
*/
|
|
47
57
|
preinstalledPackages?: readonly string[];
|
|
48
58
|
|
|
49
59
|
/**
|
|
50
60
|
* Optional execute hook. When provided, the shell renders an "Execute"
|
|
51
61
|
* button; on click it calls `service.bundle(...)` to get the JS and passes it
|
|
52
|
-
* here.
|
|
62
|
+
* here. Calls the hook makes on `sandbox.console` are appended to the Console
|
|
63
|
+
* pane in order; its returned promise carries no messages.
|
|
53
64
|
*
|
|
54
|
-
* `sandbox.runtimeFiles` is the
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
65
|
+
* `sandbox.runtimeFiles` is the current runtime-file map produced by
|
|
66
|
+
* dependency installation in this session (package-rooted keys like
|
|
67
|
+
* `uuid/dist/index.js`). The site's executeBundle typically merges these on
|
|
68
|
+
* top of its own typia-runtime pack and feeds the union to
|
|
69
|
+
* `createSandboxRequire` — without this channel the in-page Execute sandbox
|
|
70
|
+
* cannot resolve any npm dependency the user installed.
|
|
60
71
|
*
|
|
61
72
|
* `sandbox.signal` aborts when source or compiler options change, a newer
|
|
62
|
-
* Execute starts, or the shell unmounts.
|
|
63
|
-
* to cancellable setup such as
|
|
64
|
-
* user code cannot be preempted
|
|
65
|
-
* untrusted code is accepted.
|
|
73
|
+
* Execute starts, the compiler Worker is replaced, or the shell unmounts.
|
|
74
|
+
* Implementations must pass it through to cancellable setup such as
|
|
75
|
+
* runtime-pack fetches. Synchronous evaluated user code cannot be preempted
|
|
76
|
+
* and still requires an isolated executor when untrusted code is accepted.
|
|
66
77
|
*
|
|
67
78
|
* When omitted, the Execute UI is hidden.
|
|
68
79
|
*/
|
|
69
|
-
executeBundle?:
|
|
70
|
-
code: string,
|
|
71
|
-
sandbox: {
|
|
72
|
-
console: Record<string, (...args: unknown[]) => void>;
|
|
73
|
-
runtimeFiles: Record<string, string>;
|
|
74
|
-
signal: AbortSignal;
|
|
75
|
-
},
|
|
76
|
-
) => Promise<void>;
|
|
80
|
+
executeBundle?: PlaygroundBundleExecutor;
|
|
77
81
|
|
|
78
82
|
/**
|
|
79
83
|
* Brand slot in the toolbar (left side). Renders before the Playground label.
|
|
@@ -86,5 +90,41 @@ export interface IPlaygroundShellProps {
|
|
|
86
90
|
* Defaults to `"dist/playground.js"`. Receives the current transform options
|
|
87
91
|
* so sites can append `· typia disabled` etc.
|
|
88
92
|
*/
|
|
89
|
-
resultCaption?:
|
|
93
|
+
resultCaption?: PlaygroundResultCaption;
|
|
90
94
|
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Execute emitted code with session runtime files and attempt-scoped
|
|
98
|
+
* cancellation.
|
|
99
|
+
*
|
|
100
|
+
* The site owns execution isolation. The abort signal can cancel asynchronous
|
|
101
|
+
* setup, but cannot preempt synchronous evaluated code.
|
|
102
|
+
*
|
|
103
|
+
* @evidence contracts/common.md#principled-implementation Emitted code, package-rooted runtime files and cancellation preserve the shell's real execution inputs and isolation boundary.
|
|
104
|
+
* @evidence contracts/common.md#clear-and-simple-design One asynchronous hook keeps site execution policy separate from bundling, console presentation and compiler Worker ownership.
|
|
105
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts A declared hook permits site-owned isolation without patching foreign runtime behavior.
|
|
106
|
+
* @evidence contracts/common.md#meaningful-documentation Native paragraphs describe cancellation limits and ownership before the acknowledgment tags.
|
|
107
|
+
*/
|
|
108
|
+
export type PlaygroundBundleExecutor = (
|
|
109
|
+
code: string,
|
|
110
|
+
sandbox: {
|
|
111
|
+
/** Console methods supplied by the shell for this execution attempt. */
|
|
112
|
+
console: Record<string, (...args: unknown[]) => void>;
|
|
113
|
+
|
|
114
|
+
/** Package-rooted runtime modules in the current dependency graph. */
|
|
115
|
+
runtimeFiles: Record<string, string>;
|
|
116
|
+
|
|
117
|
+
/** Cancellation for setup and asynchronous work, not synchronous user code. */
|
|
118
|
+
signal: AbortSignal;
|
|
119
|
+
},
|
|
120
|
+
) => Promise<void>;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Choose a result-pane caption from current transform options.
|
|
124
|
+
*
|
|
125
|
+
* @evidence contracts/common.md#principled-implementation Current options select presentation text only, without claiming to select emitted filenames.
|
|
126
|
+
* @evidence contracts/common.md#clear-and-simple-design A string-returning presentation callback stays independent of compiler configuration.
|
|
127
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts A caption is a UI label rather than evidence that a particular output was produced.
|
|
128
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose identifies the display purpose and parameter before the separated tags.
|
|
129
|
+
*/
|
|
130
|
+
export type PlaygroundResultCaption = (options: ITransformOptions) => string;
|
|
@@ -3,16 +3,35 @@
|
|
|
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
|
+
|
|
15
|
+
/** Publish the editor's complete current text to the controlling owner. */
|
|
16
|
+
onChange: SourceEditorChangeHandler;
|
|
17
|
+
|
|
10
18
|
/**
|
|
11
19
|
* Map of file path → declaration text. Mounted into Monaco's TypeScript
|
|
12
20
|
* extra-libs registry. Hot-replaceable: the editor disposes the previous libs
|
|
13
21
|
* and re-mounts when the map identity changes.
|
|
14
22
|
*/
|
|
15
23
|
extraLibs?: Record<string, string>;
|
|
24
|
+
|
|
16
25
|
/** Editor model URI. Defaults to `file:///src/playground.ts`. */
|
|
17
26
|
path?: string;
|
|
18
27
|
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Publish the editor's complete text to its controlling owner.
|
|
31
|
+
*
|
|
32
|
+
* @evidence contracts/common.md#principled-implementation The full-text parameter matches the controlled value model without requiring edit-delta reconstruction.
|
|
33
|
+
* @evidence contracts/common.md#clear-and-simple-design One void notification leaves text state with the parent.
|
|
34
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The supported event boundary avoids mutating parent state or editor globals.
|
|
35
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose names the payload and owner, separated from the acknowledgment tags.
|
|
36
|
+
*/
|
|
37
|
+
export type SourceEditorChangeHandler = (value: string) => void;
|
|
@@ -4,12 +4,19 @@
|
|
|
4
4
|
* verbs `createWorkerCompiler` calls by default; sites that wire additional
|
|
5
5
|
* plugins can extend this interface via TypeScript declaration merging or pass
|
|
6
6
|
* a richer shape through `[key: string]: boolean | undefined`.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/common.md#principled-implementation Optional boolean flags distinguish default integration behavior from explicit disabling; the index signature permits additional boolean site flags.
|
|
9
|
+
* @evidence contracts/common.md#clear-and-simple-design Per-call flags stay independent of factory plugin registration and UI labels.
|
|
10
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Extensible keys pass through the declared option boundary instead of adding site-specific dispatcher branches.
|
|
11
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose explains extension, default enablement and forwarding, with documentation-skill paragraphs and member spacing.
|
|
7
12
|
*/
|
|
8
13
|
export interface ITransformOptions {
|
|
9
14
|
/** Enable the typia transform plugin. Defaults to true. */
|
|
10
15
|
typia?: boolean;
|
|
16
|
+
|
|
11
17
|
/** Enable the `@ttsc/lint` preview rule pass. Defaults to true. */
|
|
12
18
|
lint?: boolean;
|
|
19
|
+
|
|
13
20
|
/** Additional site-specific toggles. */
|
|
14
21
|
[key: string]: boolean | undefined;
|
|
15
22
|
}
|
|
@@ -1,20 +1,44 @@
|
|
|
1
1
|
import type { IMemFSHost } from "@ttsc/wasm";
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Options for the typia integration of {@link createWorkerCompiler}.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/common.md#principled-implementation Host registration id, transform module and source mounting callback represent the three distinct integration inputs.
|
|
7
|
+
* @evidence contracts/common.md#clear-and-simple-design Typia-specific settings are nested away from runtime boot and per-call enablement.
|
|
8
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Default identities are supported typia configuration and remain explicitly replaceable by the site.
|
|
9
|
+
* @evidence contracts/common.md#meaningful-documentation Members explain host identity, transform module and forwarded virtual work directory, with documentation-skill paragraphs and spacing.
|
|
10
|
+
*/
|
|
4
11
|
export interface ITypiaPluginConfig {
|
|
5
12
|
/** Plugin id registered with `host.Expose` (default: `"typia"`). */
|
|
6
13
|
name?: string;
|
|
14
|
+
|
|
7
15
|
/**
|
|
8
16
|
* Module specifier the typia transform receives via `compilerOptions.plugins`
|
|
9
17
|
* (default: `"typia/lib/transform"`).
|
|
10
18
|
*/
|
|
11
19
|
transformModule?: string;
|
|
20
|
+
|
|
12
21
|
/**
|
|
13
|
-
* Optional hook to mount typia source files into the MemFS
|
|
14
|
-
*
|
|
15
|
-
* `<workDir>/node_modules/`.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
22
|
+
* Optional hook to mount typia source files into the MemFS once the wasm
|
|
23
|
+
* runtime is ready, before the first request runs. The site fetches its
|
|
24
|
+
* pre-built typia pack and writes it under `<workDir>/node_modules/`. A
|
|
25
|
+
* rejected mount is retried by the next request without starting another
|
|
26
|
+
* runtime. `workDir` is forwarded from `createWorkerCompiler` so the mount
|
|
27
|
+
* can honor a non-default project root without the site rewiring the URL.
|
|
18
28
|
*/
|
|
19
|
-
mount?:
|
|
29
|
+
mount?: TypiaSourceMount;
|
|
20
30
|
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Mount typia sources into the live virtual host after boot at the actual work
|
|
34
|
+
* directory.
|
|
35
|
+
*
|
|
36
|
+
* @evidence contracts/common.md#principled-implementation Host and workDir identify the filesystem and project root that compilation actually uses.
|
|
37
|
+
* @evidence contracts/common.md#clear-and-simple-design One asynchronous mount hook leaves boot and serial compilation with the worker factory.
|
|
38
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Mounting uses IMemFSHost without patching compiler internals or guessing the project root.
|
|
39
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose names timing, filesystem and directory ownership before the separated tags.
|
|
40
|
+
*/
|
|
41
|
+
export type TypiaSourceMount = (
|
|
42
|
+
host: IMemFSHost,
|
|
43
|
+
workDir: string,
|
|
44
|
+
) => Promise<void>;
|