@ttsc/playground 0.14.0-dev.20250530.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.
Files changed (235) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +191 -0
  3. package/lib/src/compiler/DEFAULT_ENTRY_FILE.d.ts +2 -0
  4. package/lib/src/compiler/DEFAULT_ENTRY_FILE.js +6 -0
  5. package/lib/src/compiler/DEFAULT_ENTRY_FILE.js.map +1 -0
  6. package/lib/src/compiler/DEFAULT_LINT_PLUGIN_NAME.d.ts +5 -0
  7. package/lib/src/compiler/DEFAULT_LINT_PLUGIN_NAME.js +9 -0
  8. package/lib/src/compiler/DEFAULT_LINT_PLUGIN_NAME.js.map +1 -0
  9. package/lib/src/compiler/DEFAULT_PLAYGROUND_COMPILER_OPTIONS.d.ts +19 -0
  10. package/lib/src/compiler/DEFAULT_PLAYGROUND_COMPILER_OPTIONS.js +23 -0
  11. package/lib/src/compiler/DEFAULT_PLAYGROUND_COMPILER_OPTIONS.js.map +1 -0
  12. package/lib/src/compiler/DEFAULT_TSCONFIG_PATH.d.ts +2 -0
  13. package/lib/src/compiler/DEFAULT_TSCONFIG_PATH.js +6 -0
  14. package/lib/src/compiler/DEFAULT_TSCONFIG_PATH.js.map +1 -0
  15. package/lib/src/compiler/DEFAULT_TYPIA_PLUGIN_NAME.d.ts +6 -0
  16. package/lib/src/compiler/DEFAULT_TYPIA_PLUGIN_NAME.js +10 -0
  17. package/lib/src/compiler/DEFAULT_TYPIA_PLUGIN_NAME.js.map +1 -0
  18. package/lib/src/compiler/DEFAULT_WORK_DIR.d.ts +2 -0
  19. package/lib/src/compiler/DEFAULT_WORK_DIR.js +6 -0
  20. package/lib/src/compiler/DEFAULT_WORK_DIR.js.map +1 -0
  21. package/lib/src/compiler/buildTsconfigJSON.d.ts +9 -0
  22. package/lib/src/compiler/buildTsconfigJSON.js +24 -0
  23. package/lib/src/compiler/buildTsconfigJSON.js.map +1 -0
  24. package/lib/src/compiler/createTypiaSourcePackMount.d.ts +11 -0
  25. package/lib/src/compiler/createTypiaSourcePackMount.js +29 -0
  26. package/lib/src/compiler/createTypiaSourcePackMount.js.map +1 -0
  27. package/lib/src/compiler/createWorkerCompiler.d.ts +25 -0
  28. package/lib/src/compiler/createWorkerCompiler.js +227 -0
  29. package/lib/src/compiler/createWorkerCompiler.js.map +1 -0
  30. package/lib/src/compiler/installDependenciesIntoMemFS.d.ts +12 -0
  31. package/lib/src/compiler/installDependenciesIntoMemFS.js +25 -0
  32. package/lib/src/compiler/installDependenciesIntoMemFS.js.map +1 -0
  33. package/lib/src/compiler/installTypiaSourcePack.d.ts +11 -0
  34. package/lib/src/compiler/installTypiaSourcePack.js +21 -0
  35. package/lib/src/compiler/installTypiaSourcePack.js.map +1 -0
  36. package/lib/src/compiler/internal/joinUnder.d.ts +5 -0
  37. package/lib/src/compiler/internal/joinUnder.js +13 -0
  38. package/lib/src/compiler/internal/joinUnder.js.map +1 -0
  39. package/lib/src/compiler/internal/parseLintDiagnostics.d.ts +6 -0
  40. package/lib/src/compiler/internal/parseLintDiagnostics.js +57 -0
  41. package/lib/src/compiler/internal/parseLintDiagnostics.js.map +1 -0
  42. package/lib/src/compiler/internal/safeParseTypiaTransform.d.ts +11 -0
  43. package/lib/src/compiler/internal/safeParseTypiaTransform.js +21 -0
  44. package/lib/src/compiler/internal/safeParseTypiaTransform.js.map +1 -0
  45. package/lib/src/compiler/lineColumnOf.d.ts +5 -0
  46. package/lib/src/compiler/lineColumnOf.js +15 -0
  47. package/lib/src/compiler/lineColumnOf.js.map +1 -0
  48. package/lib/src/compiler/loadTypiaSourcePack.d.ts +8 -0
  49. package/lib/src/compiler/loadTypiaSourcePack.js +33 -0
  50. package/lib/src/compiler/loadTypiaSourcePack.js.map +1 -0
  51. package/lib/src/compiler/mapDiagnostic.d.ts +9 -0
  52. package/lib/src/compiler/mapDiagnostic.js +22 -0
  53. package/lib/src/compiler/mapDiagnostic.js.map +1 -0
  54. package/lib/src/compiler/normalizeError.d.ts +2 -0
  55. package/lib/src/compiler/normalizeError.js +14 -0
  56. package/lib/src/compiler/normalizeError.js.map +1 -0
  57. package/lib/src/compiler/normalizeNodeModulePath.d.ts +8 -0
  58. package/lib/src/compiler/normalizeNodeModulePath.js +19 -0
  59. package/lib/src/compiler/normalizeNodeModulePath.js.map +1 -0
  60. package/lib/src/compiler/pickEmittedJS.d.ts +6 -0
  61. package/lib/src/compiler/pickEmittedJS.js +21 -0
  62. package/lib/src/compiler/pickEmittedJS.js.map +1 -0
  63. package/lib/src/index.d.ts +47 -0
  64. package/lib/src/index.js +104 -0
  65. package/lib/src/index.js.map +1 -0
  66. package/lib/src/npm/BUILT_IN_PLAYGROUND_PACKAGES.d.ts +6 -0
  67. package/lib/src/npm/BUILT_IN_PLAYGROUND_PACKAGES.js +15 -0
  68. package/lib/src/npm/BUILT_IN_PLAYGROUND_PACKAGES.js.map +1 -0
  69. package/lib/src/npm/collectExternalPackageNames.d.ts +5 -0
  70. package/lib/src/npm/collectExternalPackageNames.js +34 -0
  71. package/lib/src/npm/collectExternalPackageNames.js.map +1 -0
  72. package/lib/src/npm/installPlaygroundDependencies.d.ts +13 -0
  73. package/lib/src/npm/installPlaygroundDependencies.js +121 -0
  74. package/lib/src/npm/installPlaygroundDependencies.js.map +1 -0
  75. package/lib/src/npm/internal/npmRegistry.d.ts +57 -0
  76. package/lib/src/npm/internal/npmRegistry.js +216 -0
  77. package/lib/src/npm/internal/npmRegistry.js.map +1 -0
  78. package/lib/src/npm/packageNameFromSpecifier.d.ts +7 -0
  79. package/lib/src/npm/packageNameFromSpecifier.js +66 -0
  80. package/lib/src/npm/packageNameFromSpecifier.js.map +1 -0
  81. package/lib/src/react/ConsoleViewer.d.ts +7 -0
  82. package/lib/src/react/ConsoleViewer.js +57 -0
  83. package/lib/src/react/ConsoleViewer.js.map +1 -0
  84. package/lib/src/react/DEFAULT_OPTION_TOGGLES.d.ts +3 -0
  85. package/lib/src/react/DEFAULT_OPTION_TOGGLES.js +17 -0
  86. package/lib/src/react/DEFAULT_OPTION_TOGGLES.js.map +1 -0
  87. package/lib/src/react/DependencyProgressModal.d.ts +7 -0
  88. package/lib/src/react/DependencyProgressModal.js +16 -0
  89. package/lib/src/react/DependencyProgressModal.js.map +1 -0
  90. package/lib/src/react/DiagnosticsPanel.d.ts +4 -0
  91. package/lib/src/react/DiagnosticsPanel.js +15 -0
  92. package/lib/src/react/DiagnosticsPanel.js.map +1 -0
  93. package/lib/src/react/ExamplePicker.d.ts +9 -0
  94. package/lib/src/react/ExamplePicker.js +43 -0
  95. package/lib/src/react/ExamplePicker.js.map +1 -0
  96. package/lib/src/react/LintPane.d.ts +9 -0
  97. package/lib/src/react/LintPane.js +17 -0
  98. package/lib/src/react/LintPane.js.map +1 -0
  99. package/lib/src/react/OptionsPanel.d.ts +13 -0
  100. package/lib/src/react/OptionsPanel.js +43 -0
  101. package/lib/src/react/OptionsPanel.js.map +1 -0
  102. package/lib/src/react/PlaygroundShell.d.ts +2 -0
  103. package/lib/src/react/PlaygroundShell.js +609 -0
  104. package/lib/src/react/PlaygroundShell.js.map +1 -0
  105. package/lib/src/react/ResultViewer.d.ts +10 -0
  106. package/lib/src/react/ResultViewer.js +49 -0
  107. package/lib/src/react/ResultViewer.js.map +1 -0
  108. package/lib/src/react/SourceEditor.d.ts +2 -0
  109. package/lib/src/react/SourceEditor.js +74 -0
  110. package/lib/src/react/SourceEditor.js.map +1 -0
  111. package/lib/src/react/createCompilerClient.d.ts +14 -0
  112. package/lib/src/react/createCompilerClient.js +77 -0
  113. package/lib/src/react/createCompilerClient.js.map +1 -0
  114. package/lib/src/sandbox/createSandboxRequire.d.ts +11 -0
  115. package/lib/src/sandbox/createSandboxRequire.js +211 -0
  116. package/lib/src/sandbox/createSandboxRequire.js.map +1 -0
  117. package/lib/src/sandbox/loadTypiaRuntimePack.d.ts +7 -0
  118. package/lib/src/sandbox/loadTypiaRuntimePack.js +35 -0
  119. package/lib/src/sandbox/loadTypiaRuntimePack.js.map +1 -0
  120. package/lib/src/structures/IBuildTsconfigOptions.d.ts +19 -0
  121. package/lib/src/structures/IBuildTsconfigOptions.js +3 -0
  122. package/lib/src/structures/IBuildTsconfigOptions.js.map +1 -0
  123. package/lib/src/structures/ICompilerService.d.ts +84 -0
  124. package/lib/src/structures/ICompilerService.js +3 -0
  125. package/lib/src/structures/ICompilerService.js.map +1 -0
  126. package/lib/src/structures/IConsoleMessage.d.ts +10 -0
  127. package/lib/src/structures/IConsoleMessage.js +3 -0
  128. package/lib/src/structures/IConsoleMessage.js.map +1 -0
  129. package/lib/src/structures/ICreateCompilerClientOptions.d.ts +13 -0
  130. package/lib/src/structures/ICreateCompilerClientOptions.js +3 -0
  131. package/lib/src/structures/ICreateCompilerClientOptions.js.map +1 -0
  132. package/lib/src/structures/ICreateWorkerCompilerOptions.d.ts +35 -0
  133. package/lib/src/structures/ICreateWorkerCompilerOptions.js +3 -0
  134. package/lib/src/structures/ICreateWorkerCompilerOptions.js.map +1 -0
  135. package/lib/src/structures/IInstallTypiaSourcePackOptions.d.ts +18 -0
  136. package/lib/src/structures/IInstallTypiaSourcePackOptions.js +3 -0
  137. package/lib/src/structures/IInstallTypiaSourcePackOptions.js.map +1 -0
  138. package/lib/src/structures/ILintPluginConfig.d.ts +5 -0
  139. package/lib/src/structures/ILintPluginConfig.js +3 -0
  140. package/lib/src/structures/ILintPluginConfig.js.map +1 -0
  141. package/lib/src/structures/IOptionToggle.d.ts +12 -0
  142. package/lib/src/structures/IOptionToggle.js +3 -0
  143. package/lib/src/structures/IOptionToggle.js.map +1 -0
  144. package/lib/src/structures/IPlaygroundDependencyInstallOptions.d.ts +16 -0
  145. package/lib/src/structures/IPlaygroundDependencyInstallOptions.js +3 -0
  146. package/lib/src/structures/IPlaygroundDependencyInstallOptions.js.map +1 -0
  147. package/lib/src/structures/IPlaygroundDependencyInstallResult.d.ts +20 -0
  148. package/lib/src/structures/IPlaygroundDependencyInstallResult.js +3 -0
  149. package/lib/src/structures/IPlaygroundDependencyInstallResult.js.map +1 -0
  150. package/lib/src/structures/IPlaygroundDependencyPackage.d.ts +8 -0
  151. package/lib/src/structures/IPlaygroundDependencyPackage.js +3 -0
  152. package/lib/src/structures/IPlaygroundDependencyPackage.js.map +1 -0
  153. package/lib/src/structures/IPlaygroundDependencyProgress.d.ts +10 -0
  154. package/lib/src/structures/IPlaygroundDependencyProgress.js +3 -0
  155. package/lib/src/structures/IPlaygroundDependencyProgress.js.map +1 -0
  156. package/lib/src/structures/IPlaygroundDependencyProgressPhase.d.ts +5 -0
  157. package/lib/src/structures/IPlaygroundDependencyProgressPhase.js +3 -0
  158. package/lib/src/structures/IPlaygroundDependencyProgressPhase.js.map +1 -0
  159. package/lib/src/structures/IPlaygroundExample.d.ts +16 -0
  160. package/lib/src/structures/IPlaygroundExample.js +3 -0
  161. package/lib/src/structures/IPlaygroundExample.js.map +1 -0
  162. package/lib/src/structures/IPlaygroundShellProps.d.ts +70 -0
  163. package/lib/src/structures/IPlaygroundShellProps.js +3 -0
  164. package/lib/src/structures/IPlaygroundShellProps.js.map +1 -0
  165. package/lib/src/structures/ISourceEditorProps.d.ts +18 -0
  166. package/lib/src/structures/ISourceEditorProps.js +3 -0
  167. package/lib/src/structures/ISourceEditorProps.js.map +1 -0
  168. package/lib/src/structures/ITransformOptions.d.ts +15 -0
  169. package/lib/src/structures/ITransformOptions.js +3 -0
  170. package/lib/src/structures/ITransformOptions.js.map +1 -0
  171. package/lib/src/structures/ITypiaPluginConfig.d.ts +19 -0
  172. package/lib/src/structures/ITypiaPluginConfig.js +3 -0
  173. package/lib/src/structures/ITypiaPluginConfig.js.map +1 -0
  174. package/lib/src/structures/index.d.ts +18 -0
  175. package/lib/src/structures/index.js +35 -0
  176. package/lib/src/structures/index.js.map +1 -0
  177. package/package.json +66 -0
  178. package/src/compiler/DEFAULT_ENTRY_FILE.ts +2 -0
  179. package/src/compiler/DEFAULT_LINT_PLUGIN_NAME.ts +5 -0
  180. package/src/compiler/DEFAULT_PLAYGROUND_COMPILER_OPTIONS.ts +19 -0
  181. package/src/compiler/DEFAULT_TSCONFIG_PATH.ts +2 -0
  182. package/src/compiler/DEFAULT_TYPIA_PLUGIN_NAME.ts +6 -0
  183. package/src/compiler/DEFAULT_WORK_DIR.ts +2 -0
  184. package/src/compiler/buildTsconfigJSON.ts +22 -0
  185. package/src/compiler/createTypiaSourcePackMount.ts +32 -0
  186. package/src/compiler/createWorkerCompiler.ts +273 -0
  187. package/src/compiler/installDependenciesIntoMemFS.ts +28 -0
  188. package/src/compiler/installTypiaSourcePack.ts +24 -0
  189. package/src/compiler/internal/joinUnder.ts +8 -0
  190. package/src/compiler/internal/parseLintDiagnostics.ts +61 -0
  191. package/src/compiler/internal/safeParseTypiaTransform.ts +24 -0
  192. package/src/compiler/lineColumnOf.ts +14 -0
  193. package/src/compiler/loadTypiaSourcePack.ts +37 -0
  194. package/src/compiler/mapDiagnostic.ts +26 -0
  195. package/src/compiler/normalizeError.ts +12 -0
  196. package/src/compiler/normalizeNodeModulePath.ts +13 -0
  197. package/src/compiler/pickEmittedJS.ts +18 -0
  198. package/src/index.ts +57 -0
  199. package/src/npm/BUILT_IN_PLAYGROUND_PACKAGES.ts +11 -0
  200. package/src/npm/collectExternalPackageNames.ts +34 -0
  201. package/src/npm/installPlaygroundDependencies.ts +163 -0
  202. package/src/npm/internal/npmRegistry.ts +292 -0
  203. package/src/npm/packageNameFromSpecifier.ts +61 -0
  204. package/src/react/ConsoleViewer.tsx +121 -0
  205. package/src/react/DEFAULT_OPTION_TOGGLES.ts +15 -0
  206. package/src/react/DependencyProgressModal.tsx +73 -0
  207. package/src/react/DiagnosticsPanel.tsx +74 -0
  208. package/src/react/ExamplePicker.tsx +93 -0
  209. package/src/react/LintPane.tsx +58 -0
  210. package/src/react/OptionsPanel.tsx +132 -0
  211. package/src/react/PlaygroundShell.tsx +864 -0
  212. package/src/react/ResultViewer.tsx +75 -0
  213. package/src/react/SourceEditor.tsx +96 -0
  214. package/src/react/createCompilerClient.ts +80 -0
  215. package/src/sandbox/createSandboxRequire.ts +275 -0
  216. package/src/sandbox/loadTypiaRuntimePack.ts +36 -0
  217. package/src/structures/IBuildTsconfigOptions.ts +19 -0
  218. package/src/structures/ICompilerService.ts +96 -0
  219. package/src/structures/IConsoleMessage.ts +10 -0
  220. package/src/structures/ICreateCompilerClientOptions.ts +13 -0
  221. package/src/structures/ICreateWorkerCompilerOptions.ts +40 -0
  222. package/src/structures/IInstallTypiaSourcePackOptions.ts +18 -0
  223. package/src/structures/ILintPluginConfig.ts +5 -0
  224. package/src/structures/IOptionToggle.ts +12 -0
  225. package/src/structures/IPlaygroundDependencyInstallOptions.ts +17 -0
  226. package/src/structures/IPlaygroundDependencyInstallResult.ts +21 -0
  227. package/src/structures/IPlaygroundDependencyPackage.ts +8 -0
  228. package/src/structures/IPlaygroundDependencyProgress.ts +11 -0
  229. package/src/structures/IPlaygroundDependencyProgressPhase.ts +12 -0
  230. package/src/structures/IPlaygroundExample.ts +16 -0
  231. package/src/structures/IPlaygroundShellProps.ts +83 -0
  232. package/src/structures/ISourceEditorProps.ts +18 -0
  233. package/src/structures/ITransformOptions.ts +15 -0
  234. package/src/structures/ITypiaPluginConfig.ts +20 -0
  235. package/src/structures/index.ts +18 -0
@@ -0,0 +1,84 @@
1
+ import type { ITransformOptions } from "./ITransformOptions";
2
+ /**
3
+ * Worker ↔ UI RPC contract for the playground compiler service.
4
+ *
5
+ * `createWorkerCompiler` (worker side) implements this. `createCompilerClient`
6
+ * (UI side) returns a tgrid Driver bound to this shape. Sites that need an
7
+ * `extraTabs` lane should layer additional verbs over this base interface in
8
+ * their own ICompilerService subtype.
9
+ */
10
+ export interface ICompilerService {
11
+ /**
12
+ * Mount external npm package files into the worker's MemFS under
13
+ * `node_modules/`. Driven by the dependency installer in
14
+ * `@ttsc/playground/npm`.
15
+ */
16
+ installDependencies(props: ICompilerService.IInstallDependenciesProps): Promise<ICompilerService.IInstallDependenciesResult>;
17
+ /**
18
+ * Compile the user's source into JavaScript with diagnostics. Plugin
19
+ * transforms (typia, when enabled in options) run first; the result is the
20
+ * post-transform emit.
21
+ */
22
+ compile(props: ICompilerService.IProps): Promise<ICompilerService.IResult>;
23
+ /**
24
+ * Same pipeline as `compile`, but using the bundle-flavored tsconfig
25
+ * (typically `module: "CommonJS"` for in-page `new Function` sandboxing).
26
+ * Sites that don't run user code may treat this identically to `compile`.
27
+ */
28
+ bundle(props: ICompilerService.IProps): Promise<ICompilerService.IResult>;
29
+ /**
30
+ * Run the lint plugin and parse its findings into the same diagnostic shape
31
+ * as `compile`. Returns an empty list when no lint plugin is wired into the
32
+ * worker.
33
+ */
34
+ lint(props: ICompilerService.IProps): Promise<ICompilerService.ILintResult>;
35
+ }
36
+ export declare namespace ICompilerService {
37
+ export interface IProps {
38
+ source: string;
39
+ options?: ITransformOptions;
40
+ }
41
+ export interface IInstallDependenciesProps {
42
+ /** Node_modules-relative paths to text content. */
43
+ files: Record<string, string>;
44
+ /** Metadata for the packages whose files are in `files`. */
45
+ packages: IInstalledPackage[];
46
+ }
47
+ export interface IInstalledPackage {
48
+ name: string;
49
+ version: string;
50
+ }
51
+ export interface IInstallDependenciesResult {
52
+ installed: IInstalledPackage[];
53
+ fileCount: number;
54
+ }
55
+ export type IResult = ISuccess | IFailure | IError;
56
+ export interface ISuccess extends IBase<"success", string> {
57
+ }
58
+ export interface IFailure extends IBase<"failure", string> {
59
+ diagnostics: IDiagnostic[];
60
+ }
61
+ export interface IError extends IBase<"error", unknown> {
62
+ }
63
+ interface IBase<Type extends string, Value> {
64
+ type: Type;
65
+ target: "javascript";
66
+ value: Value;
67
+ }
68
+ export interface IDiagnostic {
69
+ /** 1-based line number. */
70
+ line: number;
71
+ /** 1-based column number. */
72
+ column: number;
73
+ /** Length of the span in source characters; at least 1. */
74
+ length: number;
75
+ severity: "error" | "warning";
76
+ message: string;
77
+ /** Diagnostic code, e.g. `"TS2322"` or a lint rule id. */
78
+ code?: string;
79
+ }
80
+ export interface ILintResult {
81
+ diagnostics: IDiagnostic[];
82
+ }
83
+ export {};
84
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ICompilerService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ICompilerService.js","sourceRoot":"","sources":["../../../src/structures/ICompilerService.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * One captured `console.*` invocation. `value` is the argv (the spread of
3
+ * `console.log(...args)`), so `console.log("user:", user)` shows up as a single
4
+ * row with both pieces rendered inline, separated by a space — same as a real
5
+ * DevTools console.
6
+ */
7
+ export interface IConsoleMessage {
8
+ type: "debug" | "dir" | "error" | "info" | "log" | "table" | "warn";
9
+ value: unknown[];
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IConsoleMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IConsoleMessage.js","sourceRoot":"","sources":["../../../src/structures/IConsoleMessage.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ /** Options for {@link createCompilerClient}. */
2
+ export interface ICreateCompilerClientOptions {
3
+ /**
4
+ * URL of the bundled worker script (the site's rspack output of its
5
+ * `compiler/index.ts` worker entry, which calls `createWorkerCompiler`).
6
+ *
7
+ * The Worker is constructed by tgrid's `WorkerConnector` with classic- worker
8
+ * semantics. A custom Worker factory hook is intentionally not exposed — the
9
+ * upstream tgrid v1 API only accepts a URL. File an issue if you need module
10
+ * workers, named workers, or custom credentials.
11
+ */
12
+ workerUrl: string;
13
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ICreateCompilerClientOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ICreateCompilerClientOptions.js","sourceRoot":"","sources":["../../../src/structures/ICreateCompilerClientOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,35 @@
1
+ import type { ILintPluginConfig } from "./ILintPluginConfig";
2
+ import type { ITypiaPluginConfig } from "./ITypiaPluginConfig";
3
+ /** Options for {@link createWorkerCompiler}. */
4
+ export interface ICreateWorkerCompilerOptions {
5
+ /** URL of the site's pre-built playground.wasm. */
6
+ wasmUrl: string;
7
+ /** URL of the matching wasm_exec.js. Defaults to next to wasmUrl. */
8
+ wasmExecUrl?: string;
9
+ /**
10
+ * `globalThis[apiName]` the wasm binds. Must match the `apiName` passed to
11
+ * `host.Expose` when the site's wasm was built.
12
+ */
13
+ apiName: string;
14
+ /** In-MemFS project root. Defaults to `/work`. */
15
+ workDir?: string;
16
+ /** Tsconfig path relative to `workDir`. Defaults to `tsconfig.json`. */
17
+ tsconfigPath?: string;
18
+ /** Entry source path relative to `workDir`. Defaults to `src/playground.ts`. */
19
+ entryFile?: string;
20
+ /**
21
+ * Typia integration. Pass `false` to disable. When omitted, defaults to `{
22
+ * name: "typia", transformModule: "typia/lib/transform" }` — and only
23
+ * actually runs when the per-call `options.typia` is not `false`.
24
+ */
25
+ typiaPlugin?: ITypiaPluginConfig | false;
26
+ /** Lint integration. Pass `false` to disable. */
27
+ lintPlugin?: ILintPluginConfig | false;
28
+ /**
29
+ * Extra entries spliced into the tsconfig's `compilerOptions`. Use to wire
30
+ * site-specific plugins, paths, or lib overrides. The typia plugin entry is
31
+ * appended automatically when `typiaPlugin` is enabled — sites should NOT
32
+ * include it here.
33
+ */
34
+ extraCompilerOptions?: Record<string, unknown>;
35
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ICreateWorkerCompilerOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ICreateWorkerCompilerOptions.js","sourceRoot":"","sources":["../../../src/structures/ICreateWorkerCompilerOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Options for {@link installTypiaSourcePack} and
3
+ * {@link createTypiaSourcePackMount}.
4
+ */
5
+ export interface IInstallTypiaSourcePackOptions {
6
+ /** URL the site serves the pre-built typia source pack from. */
7
+ url: string;
8
+ /**
9
+ * Where to mount the pack inside the MemFS. Defaults to `/work/node_modules`,
10
+ * matching `DEFAULT_WORK_DIR + "/node_modules"`.
11
+ */
12
+ mountRoot?: string;
13
+ /**
14
+ * Optional fetcher. Defaults to `globalThis.fetch`. Override for tests or for
15
+ * sites that want their own caching strategy.
16
+ */
17
+ fetch?: (input: string) => Promise<Response>;
18
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IInstallTypiaSourcePackOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IInstallTypiaSourcePackOptions.js","sourceRoot":"","sources":["../../../src/structures/IInstallTypiaSourcePackOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /** Options for the `@ttsc/lint` integration of {@link createWorkerCompiler}. */
2
+ export interface ILintPluginConfig {
3
+ /** Plugin id registered with `host.Expose` (default: `"@ttsc/lint"`). */
4
+ name?: string;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ILintPluginConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ILintPluginConfig.js","sourceRoot":"","sources":["../../../src/structures/ILintPluginConfig.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Toggle metadata the OptionsPanel renders.
3
+ *
4
+ * Sites declare these for whatever transform plugins their wasm registered; the
5
+ * panel renders one row per entry and bubbles `onChange` with the merged
6
+ * options object.
7
+ */
8
+ export interface IOptionToggle {
9
+ key: string;
10
+ label: string;
11
+ description: string;
12
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IOptionToggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IOptionToggle.js","sourceRoot":"","sources":["../../../src/structures/IOptionToggle.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import type { IPlaygroundDependencyProgress } from "./IPlaygroundDependencyProgress";
2
+ /** Options for {@link installPlaygroundDependencies}. */
3
+ export interface IPlaygroundDependencyInstallOptions {
4
+ /** Defaults to `globalThis.fetch`. Override for tests or for offline runs. */
5
+ fetch?: (input: string, init?: RequestInit) => Promise<Response>;
6
+ /** Package names the wasm already has — skip re-installing them. */
7
+ installedPackages?: Iterable<string>;
8
+ /** Package names to never install (preinstalled / built-in). */
9
+ ignoredPackages?: Iterable<string>;
10
+ /** Safety cap: error out after installing this many packages. */
11
+ maxPackages?: number;
12
+ /** Aborts the install when triggered. */
13
+ signal?: AbortSignal;
14
+ /** Fires for each phase transition during the install. */
15
+ onProgress?: (event: IPlaygroundDependencyProgress) => void;
16
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IPlaygroundDependencyInstallOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPlaygroundDependencyInstallOptions.js","sourceRoot":"","sources":["../../../src/structures/IPlaygroundDependencyInstallOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import type { IPlaygroundDependencyPackage } from "./IPlaygroundDependencyPackage";
2
+ /** Aggregate result returned by {@link installPlaygroundDependencies}. */
3
+ export interface IPlaygroundDependencyInstallResult {
4
+ packages: IPlaygroundDependencyPackage[];
5
+ /**
6
+ * `node_modules/...` keyed map of files to mount inside the wasm-side
7
+ * compiler MemFS.
8
+ */
9
+ compilerFiles: Record<string, string>;
10
+ /**
11
+ * `file:///node_modules/...` keyed map of `.d.ts` + `package.json` files to
12
+ * register with Monaco via `addExtraLib`.
13
+ */
14
+ editorLibs: Record<string, string>;
15
+ /**
16
+ * Package-rooted runtime files (e.g. `uuid/dist/index.js`) the in-page
17
+ * execute sandbox `require` can resolve.
18
+ */
19
+ runtimeFiles: Record<string, string>;
20
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IPlaygroundDependencyInstallResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPlaygroundDependencyInstallResult.js","sourceRoot":"","sources":["../../../src/structures/IPlaygroundDependencyInstallResult.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ /** Metadata for one successfully installed npm package. */
2
+ export interface IPlaygroundDependencyPackage {
3
+ name: string;
4
+ version: string;
5
+ tarball: string;
6
+ fileCount: number;
7
+ declarationCount: number;
8
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IPlaygroundDependencyPackage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPlaygroundDependencyPackage.js","sourceRoot":"","sources":["../../../src/structures/IPlaygroundDependencyPackage.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { IPlaygroundDependencyProgressPhase } from "./IPlaygroundDependencyProgressPhase";
2
+ /** A single progress event emitted while installing playground dependencies. */
3
+ export interface IPlaygroundDependencyProgress {
4
+ phase: IPlaygroundDependencyProgressPhase;
5
+ packageName?: string;
6
+ version?: string;
7
+ completed: number;
8
+ total: number;
9
+ message: string;
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IPlaygroundDependencyProgress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPlaygroundDependencyProgress.js","sourceRoot":"","sources":["../../../src/structures/IPlaygroundDependencyProgress.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Lifecycle phase of a single dependency install reported via the progress
3
+ * callback.
4
+ */
5
+ export type IPlaygroundDependencyProgressPhase = "queued" | "resolve" | "download" | "extract" | "skip" | "error" | "done";
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IPlaygroundDependencyProgressPhase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPlaygroundDependencyProgressPhase.js","sourceRoot":"","sources":["../../../src/structures/IPlaygroundDependencyProgressPhase.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * One pre-canned source script the playground dropdown can load. Sites provide
3
+ * their own list — typia's site lists `random/is/json/protobuf`, the ttsc site
4
+ * lists `typia/lint/mixed`.
5
+ */
6
+ export interface IPlaygroundExample {
7
+ id: string;
8
+ title: string;
9
+ description: string;
10
+ source: string;
11
+ /**
12
+ * Optional grouping bucket. Examples are rendered grouped by this label.
13
+ * Defaults to "Examples" when omitted.
14
+ */
15
+ group?: string;
16
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IPlaygroundExample.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPlaygroundExample.js","sourceRoot":"","sources":["../../../src/structures/IPlaygroundExample.ts"],"names":[],"mappings":""}
@@ -0,0 +1,70 @@
1
+ import type { ReactNode } from "react";
2
+ import type { IOptionToggle } from "./IOptionToggle";
3
+ import type { IPlaygroundExample } from "./IPlaygroundExample";
4
+ import type { ITransformOptions } from "./ITransformOptions";
5
+ /**
6
+ * Props for the full playground shell.
7
+ *
8
+ * The shell is intentionally configurable rather than configurable-by-context:
9
+ * every changing field is an explicit prop, so wrappers can spread their own
10
+ * defaults without a Provider in between.
11
+ */
12
+ export interface IPlaygroundShellProps {
13
+ /**
14
+ * URL of the bundled worker script (rspack output of the site's worker
15
+ * entry).
16
+ */
17
+ workerUrl: string;
18
+ /** Source code shown on first mount (and on Reset). */
19
+ defaultScript: string;
20
+ /** Examples available in the dropdown. Empty array hides the dropdown. */
21
+ examples?: readonly IPlaygroundExample[];
22
+ /** Display labels for example groups. */
23
+ exampleGroupLabels?: Record<string, string>;
24
+ /** Toggles rendered in the Options modal. Defaults to typia + lint. */
25
+ optionToggles?: readonly IOptionToggle[];
26
+ /**
27
+ * Initial values for the transform options. Defaults to `{typia: true, lint:
28
+ * true}`.
29
+ */
30
+ defaultOptions?: ITransformOptions;
31
+ /**
32
+ * Static extra .d.ts entries to mount in Monaco (e.g. a pre-packed typia type
33
+ * pack). Merged with dependencies installed at runtime.
34
+ */
35
+ staticEditorLibs?: Record<string, string>;
36
+ /**
37
+ * Packages the site has already pre-mounted into the wasm. These are skipped
38
+ * by the runtime npm dependency installer.
39
+ */
40
+ preinstalledPackages?: readonly string[];
41
+ /**
42
+ * Optional execute hook. When provided, the shell renders an "Execute"
43
+ * button; on click it calls `service.bundle(...)` to get the JS and passes it
44
+ * here. The returned messages are appended to the Console pane.
45
+ *
46
+ * `sandbox.runtimeFiles` is the accumulated runtime-file map produced by
47
+ * every `installPlaygroundDependencies` call so far in this session
48
+ * (package-rooted keys like `uuid/dist/index.js`). The site's executeBundle
49
+ * typically merges these on top of its own typia-runtime pack and feeds the
50
+ * union to `createSandboxRequire` — without this channel the in-page Execute
51
+ * sandbox cannot resolve any npm dependency the user installed.
52
+ *
53
+ * When omitted, the Execute UI is hidden.
54
+ */
55
+ executeBundle?: (code: string, sandbox: {
56
+ console: Record<string, (...args: unknown[]) => void>;
57
+ runtimeFiles: Record<string, string>;
58
+ }) => Promise<void>;
59
+ /**
60
+ * Brand slot in the toolbar (left side). Renders before the Playground label.
61
+ * Sites typically pass `<a href="/">SiteName</a>`.
62
+ */
63
+ brand?: ReactNode;
64
+ /**
65
+ * Caption shown on the result pane when the active tab is "javascript".
66
+ * Defaults to `"dist/playground.js"`. Receives the current transform options
67
+ * so sites can append `· typia disabled` etc.
68
+ */
69
+ resultCaption?: (options: ITransformOptions) => string;
70
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IPlaygroundShellProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPlaygroundShellProps.js","sourceRoot":"","sources":["../../../src/structures/IPlaygroundShellProps.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Props for the Monaco-based source editor. The site provides `extraLibs` —
3
+ * typically the typia `.d.ts` pack and any installed npm package `.d.ts` files
4
+ * — and the editor mounts them via
5
+ * `monaco.languages.typescript.typescriptDefaults.addExtraLib`.
6
+ */
7
+ export interface ISourceEditorProps {
8
+ value: string;
9
+ onChange: (value: string) => void;
10
+ /**
11
+ * Map of file path → declaration text. Mounted into Monaco's TypeScript
12
+ * extra-libs registry. Hot-replaceable: the editor disposes the previous libs
13
+ * and re-mounts when the map identity changes.
14
+ */
15
+ extraLibs?: Record<string, string>;
16
+ /** Editor model URI. Defaults to `file:///src/playground.ts`. */
17
+ path?: string;
18
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ISourceEditorProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ISourceEditorProps.js","sourceRoot":"","sources":["../../../src/structures/ISourceEditorProps.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Toggle flags the UI surfaces in the Options panel and forwards to the worker
3
+ * on every compile. The built-in `typia` and `lint` keys mirror the two plugin
4
+ * verbs `createWorkerCompiler` calls by default; sites that wire additional
5
+ * plugins can extend this interface via TypeScript declaration merging or pass
6
+ * a richer shape through `[key: string]: boolean | undefined`.
7
+ */
8
+ export interface ITransformOptions {
9
+ /** Enable the typia transform plugin. Defaults to true. */
10
+ typia?: boolean;
11
+ /** Enable the `@ttsc/lint` preview rule pass. Defaults to true. */
12
+ lint?: boolean;
13
+ /** Additional site-specific toggles. */
14
+ [key: string]: boolean | undefined;
15
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ITransformOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITransformOptions.js","sourceRoot":"","sources":["../../../src/structures/ITransformOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import type { IMemFSHost } from "@ttsc/wasm";
2
+ /** Options for the typia integration of {@link createWorkerCompiler}. */
3
+ export interface ITypiaPluginConfig {
4
+ /** Plugin id registered with `host.Expose` (default: `"typia"`). */
5
+ name?: string;
6
+ /**
7
+ * Module specifier the typia transform receives via `compilerOptions.plugins`
8
+ * (default: `"typia/lib/transform"`).
9
+ */
10
+ transformModule?: string;
11
+ /**
12
+ * Optional hook to mount typia source files into the MemFS during boot. The
13
+ * site fetches its pre-built typia pack and writes it under
14
+ * `<workDir>/node_modules/`. `workDir` is forwarded from
15
+ * `createWorkerCompiler` so the mount can honor a non-default project root
16
+ * without the site rewiring the URL.
17
+ */
18
+ mount?: (host: IMemFSHost, workDir: string) => Promise<void>;
19
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ITypiaPluginConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITypiaPluginConfig.js","sourceRoot":"","sources":["../../../src/structures/ITypiaPluginConfig.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ export * from "./IBuildTsconfigOptions";
2
+ export * from "./ICompilerService";
3
+ export * from "./IConsoleMessage";
4
+ export * from "./ICreateCompilerClientOptions";
5
+ export * from "./ICreateWorkerCompilerOptions";
6
+ export * from "./IInstallTypiaSourcePackOptions";
7
+ export * from "./ILintPluginConfig";
8
+ export * from "./IOptionToggle";
9
+ export * from "./IPlaygroundDependencyInstallOptions";
10
+ export * from "./IPlaygroundDependencyInstallResult";
11
+ export * from "./IPlaygroundDependencyPackage";
12
+ export * from "./IPlaygroundDependencyProgress";
13
+ export * from "./IPlaygroundDependencyProgressPhase";
14
+ export * from "./IPlaygroundExample";
15
+ export * from "./IPlaygroundShellProps";
16
+ export * from "./ISourceEditorProps";
17
+ export * from "./ITransformOptions";
18
+ export * from "./ITypiaPluginConfig";
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./IBuildTsconfigOptions"), exports);
18
+ __exportStar(require("./ICompilerService"), exports);
19
+ __exportStar(require("./IConsoleMessage"), exports);
20
+ __exportStar(require("./ICreateCompilerClientOptions"), exports);
21
+ __exportStar(require("./ICreateWorkerCompilerOptions"), exports);
22
+ __exportStar(require("./IInstallTypiaSourcePackOptions"), exports);
23
+ __exportStar(require("./ILintPluginConfig"), exports);
24
+ __exportStar(require("./IOptionToggle"), exports);
25
+ __exportStar(require("./IPlaygroundDependencyInstallOptions"), exports);
26
+ __exportStar(require("./IPlaygroundDependencyInstallResult"), exports);
27
+ __exportStar(require("./IPlaygroundDependencyPackage"), exports);
28
+ __exportStar(require("./IPlaygroundDependencyProgress"), exports);
29
+ __exportStar(require("./IPlaygroundDependencyProgressPhase"), exports);
30
+ __exportStar(require("./IPlaygroundExample"), exports);
31
+ __exportStar(require("./IPlaygroundShellProps"), exports);
32
+ __exportStar(require("./ISourceEditorProps"), exports);
33
+ __exportStar(require("./ITransformOptions"), exports);
34
+ __exportStar(require("./ITypiaPluginConfig"), exports);
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structures/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,qDAAmC;AACnC,oDAAkC;AAClC,iEAA+C;AAC/C,iEAA+C;AAC/C,mEAAiD;AACjD,sDAAoC;AACpC,kDAAgC;AAChC,wEAAsD;AACtD,uEAAqD;AACrD,iEAA+C;AAC/C,kEAAgD;AAChD,uEAAqD;AACrD,uDAAqC;AACrC,0DAAwC;AACxC,uDAAqC;AACrC,sDAAoC;AACpC,uDAAqC"}