@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,216 @@
1
+ "use strict";
2
+ // Internal npm-registry helpers used by `installPlaygroundDependencies`.
3
+ // Grouped in one file because every helper is privately coupled to the tar
4
+ // + version-resolve + tarball-extract flow; splitting them per the public
5
+ // "one symbol per file" rule would make the install path harder to follow.
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.DECLARATION_FILE_REGEXP = void 0;
8
+ exports.throwIfAborted = throwIfAborted;
9
+ exports.fetchNpmMetadata = fetchNpmMetadata;
10
+ exports.selectVersion = selectVersion;
11
+ exports.downloadTarball = downloadTarball;
12
+ exports.unpackNpmTarball = unpackNpmTarball;
13
+ exports.mountPackageFiles = mountPackageFiles;
14
+ exports.enqueuePackageDependencies = enqueuePackageDependencies;
15
+ exports.toTypesPackageName = toTypesPackageName;
16
+ const TEXT_FILE_REGEXP = /(^package\.json$|\.([cm]?js|jsx|[cm]?ts|tsx|json)$|\.d\.[cm]?ts$)/i;
17
+ exports.DECLARATION_FILE_REGEXP = /\.d\.[cm]?ts$/i;
18
+ const RUNTIME_FILE_REGEXP = /(^package\.json$|\.([cm]?js|json)$)/i;
19
+ function throwIfAborted(signal) {
20
+ if (!signal?.aborted)
21
+ return;
22
+ if (signal.reason !== undefined)
23
+ throw signal.reason;
24
+ throw new DOMException("The operation was aborted.", "AbortError");
25
+ }
26
+ async function fetchNpmMetadata(fetchImpl, packageName, optional, signal) {
27
+ const response = await fetchImpl(`https://registry.npmjs.org/${encodeURIComponent(packageName)}`, {
28
+ headers: {
29
+ Accept: "application/vnd.npm.install-v1+json, application/json",
30
+ },
31
+ signal,
32
+ });
33
+ if (response.status === 404 && optional)
34
+ return null;
35
+ if (!response.ok) {
36
+ throw new Error(`npm registry returned ${response.status} while resolving ${packageName}.`);
37
+ }
38
+ return (await response.json());
39
+ }
40
+ function selectVersion(metadata, range) {
41
+ const versions = metadata.versions;
42
+ if (versions[range])
43
+ return range;
44
+ const tag = metadata["dist-tags"]?.[range];
45
+ if (tag && versions[tag])
46
+ return tag;
47
+ const normalized = range.replace(/^[~^<>= ]+/, "").trim();
48
+ if (normalized && versions[normalized])
49
+ return normalized;
50
+ const latest = metadata["dist-tags"]?.latest;
51
+ if (latest && versions[latest])
52
+ return latest;
53
+ const all = Object.keys(versions).sort(compareVersionDesc);
54
+ const fallback = all[0];
55
+ if (!fallback)
56
+ throw new Error(`No versions found for ${metadata.name}.`);
57
+ return fallback;
58
+ }
59
+ async function downloadTarball(fetchImpl, tarball, signal) {
60
+ const response = await fetchImpl(tarball, { signal });
61
+ if (!response.ok) {
62
+ throw new Error(`tarball download failed with HTTP ${response.status}.`);
63
+ }
64
+ return response.arrayBuffer();
65
+ }
66
+ async function unpackNpmTarball(tgz, signal) {
67
+ throwIfAborted(signal);
68
+ const tar = await gunzip(tgz);
69
+ throwIfAborted(signal);
70
+ const decoder = new TextDecoder();
71
+ const files = {};
72
+ let packageJson = {};
73
+ let offset = 0;
74
+ let longPath = null;
75
+ let paxPath = null;
76
+ while (offset + 512 <= tar.length) {
77
+ throwIfAborted(signal);
78
+ const header = tar.subarray(offset, offset + 512);
79
+ offset += 512;
80
+ if (header.every((value) => value === 0))
81
+ break;
82
+ const type = String.fromCharCode(header[156] ?? 0);
83
+ const size = parseOctal(header.subarray(124, 136));
84
+ const body = tar.subarray(offset, offset + size);
85
+ offset += Math.ceil(size / 512) * 512;
86
+ if (type === "L") {
87
+ longPath = trimNull(decoder.decode(body));
88
+ continue;
89
+ }
90
+ if (type === "x") {
91
+ paxPath = parsePaxPath(decoder.decode(body));
92
+ continue;
93
+ }
94
+ if (type !== "0" && type !== "\0") {
95
+ longPath = null;
96
+ paxPath = null;
97
+ continue;
98
+ }
99
+ const rawPath = paxPath ?? longPath ?? readTarString(header.subarray(0, 100), decoder);
100
+ longPath = null;
101
+ paxPath = null;
102
+ const rel = stripTarRoot(rawPath);
103
+ if (!rel || !TEXT_FILE_REGEXP.test(rel))
104
+ continue;
105
+ const text = decoder.decode(body);
106
+ files[rel] = text;
107
+ if (rel === "package.json") {
108
+ try {
109
+ packageJson = JSON.parse(text);
110
+ }
111
+ catch {
112
+ packageJson = {};
113
+ }
114
+ }
115
+ }
116
+ return { files, packageJson };
117
+ }
118
+ async function gunzip(input) {
119
+ if (!("DecompressionStream" in globalThis)) {
120
+ throw new Error("This browser cannot unpack npm tgz files because DecompressionStream is unavailable.");
121
+ }
122
+ const stream = new Blob([input])
123
+ .stream()
124
+ .pipeThrough(new DecompressionStream("gzip"));
125
+ return new Uint8Array(await new Response(stream).arrayBuffer());
126
+ }
127
+ function mountPackageFiles(packageName, files) {
128
+ const compilerFiles = {};
129
+ const editorLibs = {};
130
+ const runtimeFiles = {};
131
+ for (const [rel, text] of Object.entries(files)) {
132
+ const packageRel = `${packageName}/${rel}`;
133
+ compilerFiles[`node_modules/${packageRel}`] = text;
134
+ if (rel === "package.json" || exports.DECLARATION_FILE_REGEXP.test(rel)) {
135
+ editorLibs[`file:///node_modules/${packageRel}`] = text;
136
+ }
137
+ if (RUNTIME_FILE_REGEXP.test(rel)) {
138
+ runtimeFiles[packageRel] = text;
139
+ }
140
+ }
141
+ return { compilerFiles, editorLibs, runtimeFiles };
142
+ }
143
+ function enqueuePackageDependencies(packageJson, enqueue) {
144
+ for (const [name, range] of Object.entries(packageJson.dependencies ?? {})) {
145
+ if (isRegistryRange(range))
146
+ enqueue({ name, range, optional: false });
147
+ }
148
+ for (const [name, range] of Object.entries(packageJson.peerDependencies ?? {})) {
149
+ const optional = packageJson.peerDependenciesMeta?.[name]?.optional === true;
150
+ // Truly optional peers (peerDependenciesMeta[name].optional === true)
151
+ // are never enqueued. Required peers MUST propagate optional: false so
152
+ // a 404 on the registry surfaces as an install failure instead of a
153
+ // silent skip that leaves the wasm-side compile reporting a generic
154
+ // "Cannot find module" with no breadcrumb back to the dep installer.
155
+ if (!optional && isRegistryRange(range))
156
+ enqueue({ name, range, optional: false });
157
+ }
158
+ }
159
+ function isRegistryRange(range) {
160
+ return !/^(file:|link:|workspace:|portal:|git\+|github:|https?:)/.test(range);
161
+ }
162
+ function toTypesPackageName(packageName) {
163
+ if (!packageName.startsWith("@"))
164
+ return `@types/${packageName}`;
165
+ const [scope, name] = packageName.slice(1).split("/");
166
+ return scope && name ? `@types/${scope}__${name}` : `@types/${packageName}`;
167
+ }
168
+ function readTarString(bytes, decoder) {
169
+ return trimNull(decoder.decode(bytes));
170
+ }
171
+ function trimNull(text) {
172
+ const index = text.indexOf("\0");
173
+ return (index < 0 ? text : text.slice(0, index)).trim();
174
+ }
175
+ function parseOctal(bytes) {
176
+ const text = trimNull(new TextDecoder().decode(bytes)).trim();
177
+ return text ? Number.parseInt(text, 8) : 0;
178
+ }
179
+ function parsePaxPath(text) {
180
+ let rest = text;
181
+ while (rest.length > 0) {
182
+ const space = rest.indexOf(" ");
183
+ if (space < 0)
184
+ return null;
185
+ const length = Number(rest.slice(0, space));
186
+ if (!Number.isFinite(length) || length <= space)
187
+ return null;
188
+ const record = rest.slice(space + 1, length - 1);
189
+ const eq = record.indexOf("=");
190
+ if (eq > 0 && record.slice(0, eq) === "path")
191
+ return record.slice(eq + 1);
192
+ rest = rest.slice(length);
193
+ }
194
+ return null;
195
+ }
196
+ function stripTarRoot(path) {
197
+ const normalized = path.replace(/\\/g, "/").replace(/^\/+/, "");
198
+ if (!normalized)
199
+ return "";
200
+ if (normalized.startsWith("package/"))
201
+ return normalized.slice("package/".length);
202
+ const slash = normalized.indexOf("/");
203
+ return slash < 0 ? normalized : normalized.slice(slash + 1);
204
+ }
205
+ function compareVersionDesc(a, b) {
206
+ const pa = a.split(/[.-]/).map((part) => Number.parseInt(part, 10));
207
+ const pb = b.split(/[.-]/).map((part) => Number.parseInt(part, 10));
208
+ for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
209
+ const av = Number.isFinite(pa[i]) ? pa[i] : 0;
210
+ const bv = Number.isFinite(pb[i]) ? pb[i] : 0;
211
+ if (av !== bv)
212
+ return bv - av;
213
+ }
214
+ return b.localeCompare(a);
215
+ }
216
+ //# sourceMappingURL=npmRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npmRegistry.js","sourceRoot":"","sources":["../../../../src/npm/internal/npmRegistry.ts"],"names":[],"mappings":";AAAA,yEAAyE;AACzE,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;;;;;;;;;;;AA2C3E,MAAM,gBAAgB,GACpB,oEAAoE,CAAC;AAC1D,QAAA,uBAAuB,GAAG,gBAAgB,CAAC;AACxD,MAAM,mBAAmB,GAAG,sCAAsC,CAAC;AAEnE,wBAA+B,MAA+B;IAC5D,IAAI,CAAC,MAAM,EAAE,OAAO;QAAE,OAAO;IAC7B,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS;QAAE,M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B,CAAC,CAAS,EAAE,CAAS;IAC9C,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACpE,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACpE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACxD,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,IAAI,EAAE,KAAK,EAAE;YAAE,OAAO,EAAE,GAAG,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Extract the package name from a module specifier.
3
+ *
4
+ * Returns `null` for relative paths, hash imports, URL specifiers, and Node
5
+ * built-in modules — the caller doesn't install those from npm.
6
+ */
7
+ export declare function packageNameFromSpecifier(specifier: string): string | null;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.packageNameFromSpecifier = packageNameFromSpecifier;
4
+ const BUILTIN_MODULES = new Set([
5
+ "assert",
6
+ "buffer",
7
+ "child_process",
8
+ "console",
9
+ "constants",
10
+ "crypto",
11
+ "dns",
12
+ "events",
13
+ "fs",
14
+ "http",
15
+ "https",
16
+ "module",
17
+ "net",
18
+ "os",
19
+ "path",
20
+ "perf_hooks",
21
+ "process",
22
+ "punycode",
23
+ "querystring",
24
+ "readline",
25
+ "stream",
26
+ "string_decoder",
27
+ "timers",
28
+ "tls",
29
+ "tty",
30
+ "url",
31
+ "util",
32
+ "vm",
33
+ "worker_threads",
34
+ "zlib",
35
+ ]);
36
+ /**
37
+ * Extract the package name from a module specifier.
38
+ *
39
+ * Returns `null` for relative paths, hash imports, URL specifiers, and Node
40
+ * built-in modules — the caller doesn't install those from npm.
41
+ */
42
+ function packageNameFromSpecifier(specifier) {
43
+ if (specifier.startsWith("#") ||
44
+ specifier.startsWith(".") ||
45
+ specifier.startsWith("/") ||
46
+ /^[a-z][a-z0-9+.-]*:/i.test(specifier))
47
+ return null;
48
+ const bare = specifier.startsWith("node:") ? specifier.slice(5) : specifier;
49
+ const first = bare.split("/")[0];
50
+ if (first && BUILTIN_MODULES.has(first))
51
+ return null;
52
+ if (bare.startsWith("@")) {
53
+ const firstSlash = bare.indexOf("/");
54
+ if (firstSlash < 0)
55
+ return null;
56
+ if (firstSlash === 1)
57
+ return null;
58
+ const secondSlash = bare.indexOf("/", firstSlash + 1);
59
+ if (secondSlash === firstSlash + 1)
60
+ return null;
61
+ return secondSlash < 0 ? bare : bare.slice(0, secondSlash);
62
+ }
63
+ const slash = bare.indexOf("/");
64
+ return slash < 0 ? bare : bare.slice(0, slash);
65
+ }
66
+ //# sourceMappingURL=packageNameFromSpecifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageNameFromSpecifier.js","sourceRoot":"","sources":["../../../src/npm/packageNameFromSpecifier.ts"],"names":[],"mappings":";;;AAAA,MAAM,eAAe,GAAG,IAAI,GAAG,CAA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AAC,CAAC;QACtD,IAAI,WAAW,KAAK,UAAU,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAChD,OAAO,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;IAC7D,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAChC,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { IConsoleMessage } from "../structures/IConsoleMessage";
2
+ interface ConsoleViewerProps {
3
+ messages: IConsoleMessage[];
4
+ empty?: string;
5
+ }
6
+ export declare function ConsoleViewer({ messages, empty, }: ConsoleViewerProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ConsoleViewer = ConsoleViewer;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ function ConsoleViewer({ messages, empty = "No output yet. Click Execute to run the compiled JavaScript.", }) {
7
+ if (messages.length === 0)
8
+ return ((0, jsx_runtime_1.jsx)("div", { className: "h-full w-full flex items-center justify-center text-neutral-600 font-mono text-[11px] px-4 text-center", children: empty }));
9
+ return ((0, jsx_runtime_1.jsx)("div", { className: "h-full w-full overflow-auto p-3 font-mono text-[12px] leading-snug", children: messages.map((msg, i) => ((0, jsx_runtime_1.jsxs)("div", { className: "py-1 border-b border-neutral-900/70 last:border-b-0 flex gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: `shrink-0 text-[10px] uppercase tracking-wider w-12 ${typeColor(msg.type)}`, children: msg.type }), (0, jsx_runtime_1.jsx)("span", { className: "flex-1 break-words whitespace-pre-wrap text-neutral-200", children: (Array.isArray(msg.value) ? msg.value : [msg.value]).map((arg, idx) => ((0, jsx_runtime_1.jsxs)("span", { children: [idx > 0 ? " " : "", formatValue(arg)] }, idx))) })] }, i))) }));
10
+ }
11
+ function typeColor(type) {
12
+ switch (type) {
13
+ case "error":
14
+ return "text-red-400";
15
+ case "warn":
16
+ return "text-yellow-400";
17
+ case "info":
18
+ return "text-sky-400";
19
+ case "debug":
20
+ return "text-fuchsia-400";
21
+ case "dir":
22
+ case "table":
23
+ return "text-cyan-400";
24
+ default:
25
+ return "text-emerald-400";
26
+ }
27
+ }
28
+ function formatValue(value, depth = 0) {
29
+ if (typeof value === "string")
30
+ return (0, jsx_runtime_1.jsx)("span", { className: "text-amber-200", children: JSON.stringify(value) });
31
+ if (typeof value === "number")
32
+ return (0, jsx_runtime_1.jsx)("span", { className: "text-purple-300", children: String(value) });
33
+ if (typeof value === "boolean")
34
+ return (0, jsx_runtime_1.jsx)("span", { className: "text-sky-300", children: String(value) });
35
+ if (value === null)
36
+ return (0, jsx_runtime_1.jsx)("span", { className: "text-neutral-500", children: "null" });
37
+ if (value === undefined)
38
+ return (0, jsx_runtime_1.jsx)("span", { className: "text-neutral-500", children: "undefined" });
39
+ if (typeof value === "function")
40
+ return (0, jsx_runtime_1.jsx)("span", { className: "text-neutral-500", children: "[Function]" });
41
+ if (Array.isArray(value))
42
+ return ((0, jsx_runtime_1.jsxs)("span", { children: ["[", value.map((item, idx) => ((0, jsx_runtime_1.jsxs)("span", { children: [idx > 0 ? ", " : "", formatValue(item, depth + 1)] }, idx))), "]"] }));
43
+ if (value instanceof Error)
44
+ return ((0, jsx_runtime_1.jsxs)("span", { className: "text-red-300", children: [value.name, ": ", value.message] }));
45
+ try {
46
+ const entries = Object.entries(value);
47
+ if (entries.length === 0)
48
+ return (0, jsx_runtime_1.jsx)("span", { children: "{}" });
49
+ if (depth > 4)
50
+ return (0, jsx_runtime_1.jsx)("span", { className: "text-neutral-500", children: "[...]" });
51
+ return ((0, jsx_runtime_1.jsxs)("span", { children: ["{", entries.map(([k, v], idx) => ((0, jsx_runtime_1.jsxs)("span", { children: [idx > 0 ? ", " : " ", (0, jsx_runtime_1.jsx)("span", { className: "text-blue-300", children: k }), ":", " ", formatValue(v, depth + 1)] }, k))), " }"] }));
52
+ }
53
+ catch {
54
+ return (0, jsx_runtime_1.jsx)("span", { children: String(value) });
55
+ }
56
+ }
57
+ //# sourceMappingURL=ConsoleViewer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleViewer.js","sourceRoot":"","sources":["../../../src/react/ConsoleViewer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AAWb,uBAA8B,EAC5B,QAAQ,EACR,KAAK,GAAG,8DAA8D,GACnD;IACnB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QACvB,OAAO,CACL,gCAAK,SAAS,EAAC,wGAAwG,YACpH,KAAK,GACF,CACP,CAAC;IACJ,OAAO,CACL,gCAAK,SAAS,EAAC,oEAAoE,YAChF,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CACxB,iCAEE,SAAS,EAAC,gEAAgE,aAE1E,iCACE,SAAS,EAAE,sDAAsD,SAAS,CACxE,GAAG,CAAC,IAAI,CACT,EAAE,YAEF,GAAG,CAAC,IAAI,GACJ,EACP,iCAAM,SAAS,EAAC,yDAAyD,YACtE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CACvD,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CACZ,6CACG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAClB,WAAW,CAAC,GAAG,CAAC,KAFR,GAAG,CAGP,CACR,CACF,GACI,KA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AAC,CACxB,6CACG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EACnB,WAAW,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,KAFpB,GAAG,CAGP,CACR,CAAC,SAEG,CACR,CAAC;IACJ,IAAI,KAAK,YAAY,KAAK;QACxB,OAAO,CACL,kCAAM,SAAS,EAAC,cAAc,aAC3B,KAAK,CAAC,IAAI,QAAI,KAAK,CAAC,OAAO,IACvB,CACR,CAAC;IACJ,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,CAAC;QACjE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,2CAAO,IAAI,GAAQ,CAAC;QACrD,IAAI,KAAK,GAAG,CAAC;YAAE,OAAO,iCAAM,SAAS,EAAC,kBAAkB,sBAAa,CAAC;QACtE,OAAO,CACL,6CACG,GAAG,EACH,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAC5B,6CACG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,EACrB,iCAAM,SAAS,EAAC,eAAe,YAAE,CAAC,GAAQ,OAAE,GAAG,EAC9C,WAAW,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,KAHjB,CAAC,CAIL,CACR,CAAC,EACD,IAAI,IACA,CACR,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,2CAAO,MAAM,CAAC,KAAK,CAAC,GAAQ,CAAC;IACtC,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { IOptionToggle } from "../structures/IOptionToggle";
2
+ /** Default toggles for sites that wire the bundled typia / lint plugins. */
3
+ export declare const DEFAULT_OPTION_TOGGLES: readonly IOptionToggle[];
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_OPTION_TOGGLES = void 0;
4
+ /** Default toggles for sites that wire the bundled typia / lint plugins. */
5
+ exports.DEFAULT_OPTION_TOGGLES = [
6
+ {
7
+ key: "typia",
8
+ label: "typia",
9
+ description: "Generate runtime validators from TypeScript types.",
10
+ },
11
+ {
12
+ key: "lint",
13
+ label: "@ttsc/lint",
14
+ description: "Report a subset of lint rules over the source AST.",
15
+ },
16
+ ];
17
+ //# sourceMappingURL=DEFAULT_OPTION_TOGGLES.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DEFAULT_OPTION_TOGGLES.js","sourceRoot":"","sources":["../../../src/react/DEFAULT_OPTION_TOGGLES.ts"],"names":[],"mappings":";;;AAEA,4EAA4E;AAC/D,QAAA,sBAAsB,GAA6B;IAC9D;QACE,GAAG,EAAE,OAAO;QACZ,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,oDAAoD;KAClE;IACD;QACE,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,oDAAoD;KAClE;CACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { IPlaygroundDependencyProgress } from "../structures/IPlaygroundDependencyProgress";
2
+ interface DependencyProgressModalProps {
3
+ progress: IPlaygroundDependencyProgress | null;
4
+ packages: readonly string[];
5
+ }
6
+ export declare function DependencyProgressModal({ progress, packages, }: DependencyProgressModalProps): import("react/jsx-runtime").JSX.Element | null;
7
+ export {};
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.DependencyProgressModal = DependencyProgressModal;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ function DependencyProgressModal({ progress, packages, }) {
7
+ if (!progress)
8
+ return null;
9
+ const total = Math.max(progress.total, 1);
10
+ const ratio = Math.min(1, Math.max(0, progress.completed / total));
11
+ const activePackage = progress.packageName && progress.version
12
+ ? `${progress.packageName}@${progress.version}`
13
+ : progress.packageName;
14
+ return ((0, jsx_runtime_1.jsx)("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/70 px-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "w-full max-w-md rounded-lg border border-neutral-700 bg-neutral-950 p-5 shadow-2xl", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-start justify-between gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[11px] font-mono uppercase text-blue-300", children: "Dependencies" }), (0, jsx_runtime_1.jsx)("h2", { className: "mt-1 text-base font-mono text-white", children: "Installing npm packages" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-[11px] font-mono text-neutral-500", children: [progress.completed, "/", total] })] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-4 h-2 overflow-hidden rounded-full bg-neutral-800", children: (0, jsx_runtime_1.jsx)("div", { className: "h-full bg-blue-400 transition-[width]", style: { width: `${Math.max(8, ratio * 100)}%` } }) }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-4 space-y-1 font-mono", children: [activePackage && ((0, jsx_runtime_1.jsx)("div", { className: "text-[12px] text-neutral-200", children: activePackage })), (0, jsx_runtime_1.jsx)("div", { className: "text-[11px] text-neutral-400", children: progress.message })] }), packages.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "mt-4 flex flex-wrap gap-1.5", children: [packages.slice(0, 8).map((name) => ((0, jsx_runtime_1.jsx)("span", { className: "rounded border border-neutral-800 bg-neutral-900 px-2 py-1 text-[10px] font-mono text-neutral-300", children: name }, name))), packages.length > 8 && ((0, jsx_runtime_1.jsxs)("span", { className: "rounded border border-neutral-800 bg-neutral-900 px-2 py-1 text-[10px] font-mono text-neutral-500", children: ["+", packages.length - 8] }))] }))] }) }));
15
+ }
16
+ //# sourceMappingURL=DependencyProgressModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DependencyProgressModal.js","sourceRoot":"","sources":["../../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IAClE,EAEL,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,CACtB,iCAAK,SAAS,EAAC,6BAA6B,aACzC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAClC,iCAEE,SAAS,EAAC,mGAAmG,YAE5G,IAAI,IAHA,IAAI,CAIJ,CACR,CAAC,EACD,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,CACtB,kCAAM,SAAS,EAAC,mGAAmG,kBAC/G,QAAQ,CAAC,MAAM,GAAG,CAAC,IAChB,CACR,IACG,CACP,IACG,GACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ICompilerService } from "../structures/ICompilerService";
2
+ export declare function DiagnosticsPanel({ diagnostics, }: {
3
+ diagnostics: ICompilerService.IDiagnostic[];
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.DiagnosticsPanel = DiagnosticsPanel;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ function DiagnosticsPanel({ diagnostics, }) {
8
+ const [expanded, setExpanded] = (0, react_1.useState)(false);
9
+ const errorCount = diagnostics.filter((d) => d.severity === "error").length;
10
+ const warnCount = diagnostics.filter((d) => d.severity === "warning").length;
11
+ if (diagnostics.length === 0)
12
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "shrink-0 px-4 py-2 border-t border-neutral-800/70 bg-neutral-950 flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-emerald-400 text-xs", children: "\u25CF" }), (0, jsx_runtime_1.jsx)("span", { className: "text-[12px] font-mono text-neutral-400", children: "0 errors \u00B7 0 warnings" })] }));
13
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "shrink-0 border-t border-neutral-800/70 bg-neutral-950", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setExpanded((v) => !v), className: "w-full px-4 py-2 flex items-center gap-3 hover:bg-neutral-900/50 transition-colors text-left", children: [(0, jsx_runtime_1.jsx)("span", { className: `text-xs ${errorCount > 0 ? "text-red-400" : "text-yellow-400"}`, children: "\u25CF" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-[12px] font-mono text-neutral-300", children: [errorCount, " error", errorCount === 1 ? "" : "s", " \u00B7 ", warnCount, " warning", warnCount === 1 ? "" : "s"] }), (0, jsx_runtime_1.jsx)("span", { className: "ml-auto text-[10px] font-mono text-neutral-600", children: expanded ? "▲ collapse" : "▼ expand" })] }), expanded && ((0, jsx_runtime_1.jsx)("div", { className: "border-t border-neutral-800/70 max-h-48 overflow-auto", children: diagnostics.map((d, i) => ((0, jsx_runtime_1.jsxs)("div", { className: "px-4 py-2 flex gap-3 text-[12px] font-mono border-b border-neutral-900 last:border-b-0", children: [(0, jsx_runtime_1.jsx)("span", { className: `shrink-0 ${d.severity === "error" ? "text-red-400" : "text-yellow-400"}`, children: d.severity === "error" ? "✗" : "!" }), (0, jsx_runtime_1.jsxs)("span", { className: "shrink-0 text-neutral-500 w-16", children: [d.line, ":", d.column] }), (0, jsx_runtime_1.jsx)("span", { className: "shrink-0 text-neutral-600 w-16", children: d.code ?? "" }), (0, jsx_runtime_1.jsx)("span", { className: "text-neutral-200", children: d.message })] }, i))) }))] }));
14
+ }
15
+ //# sourceMappingURL=DiagnosticsPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiagnosticsPanel.js","sourceRoot":"","sources":["../../../src/react/DiagnosticsPanel.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AAEb,iCAAiC;AAIjC,0BAAiC,EAC/B,WAAW,GAGZ;IACC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAChD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,C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C,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,iBAC5C,EAAE,YAED,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAC9B,EACP,kCAAM,SAAS,EAAC,gCAAgC,aAC7C,CAAC,CAAC,IAAI,OAAG,CAAC,CAAC,MAAM,IACb,EACP,iCAAM,SAAS,EAAC,gCAAgC,YAC7C,CAAC,CAAC,IAAI,IAAI,EAAE,GACR,EACP,iCAAM,SAAS,EAAC,kBAAkB,YAAE,CAAC,CAAC,OAAO,GAAQ,KAhBhD,CAAC,CAiBF,CACP,CAAC,GACE,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { IPlaygroundExample } from "../structures/IPlaygroundExample";
2
+ interface ExamplePickerProps {
3
+ examples: readonly IPlaygroundExample[];
4
+ onPick: (id: string) => void;
5
+ /** Display labels for groups. Maps `group` key → rendered heading. */
6
+ groupLabels?: Record<string, string>;
7
+ }
8
+ export declare function ExamplePicker({ examples, onPick, groupLabels, }: ExamplePickerProps): import("react/jsx-runtime").JSX.Element | null;
9
+ export {};
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ExamplePicker = ExamplePicker;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ function ExamplePicker({ examples, onPick, groupLabels, }) {
8
+ const [open, setOpen] = (0, react_1.useState)(false);
9
+ const ref = (0, react_1.useRef)(null);
10
+ (0, react_1.useEffect)(() => {
11
+ if (!open)
12
+ return;
13
+ const close = (e) => {
14
+ if (ref.current && !ref.current.contains(e.target)) {
15
+ setOpen(false);
16
+ }
17
+ };
18
+ const onKey = (e) => {
19
+ if (e.key === "Escape")
20
+ setOpen(false);
21
+ };
22
+ document.addEventListener("mousedown", close);
23
+ document.addEventListener("keydown", onKey);
24
+ return () => {
25
+ document.removeEventListener("mousedown", close);
26
+ document.removeEventListener("keydown", onKey);
27
+ };
28
+ }, [open]);
29
+ const grouped = (0, react_1.useMemo)(() => {
30
+ return examples.reduce((acc, e) => {
31
+ const key = e.group ?? "Examples";
32
+ (acc[key] ??= []).push(e);
33
+ return acc;
34
+ }, {});
35
+ }, [examples]);
36
+ if (examples.length === 0)
37
+ return null;
38
+ return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, className: "relative", children: [(0, jsx_runtime_1.jsx)("button", { "data-playground-examples-toggle": true, onClick: () => setOpen((v) => !v), className: "px-3 py-1.5 text-xs font-mono text-neutral-300 border border-neutral-800 rounded-md hover:border-neutral-600 hover:bg-neutral-900 transition-colors", title: "Cmd/Ctrl+K", children: "Examples \u25BE" }), open && ((0, jsx_runtime_1.jsx)("div", { className: "absolute right-0 top-full mt-2 w-80 rounded-lg border border-neutral-800 bg-neutral-950 shadow-[0_10px_40px_rgba(0,0,0,0.6)] z-10 overflow-hidden", children: Object.entries(grouped).map(([group, items]) => ((0, jsx_runtime_1.jsxs)("div", { className: "border-b border-neutral-900 last:border-b-0", children: [(0, jsx_runtime_1.jsx)("div", { className: "px-3 py-1.5 text-[10px] font-mono uppercase tracking-wider text-neutral-600", children: groupLabels?.[group] ?? group }), items.map((item) => ((0, jsx_runtime_1.jsxs)("button", { onClick: () => {
39
+ onPick(item.id);
40
+ setOpen(false);
41
+ }, className: "w-full text-left px-3 py-2 hover:bg-neutral-900 transition-colors", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[12px] font-mono text-neutral-100", children: item.title }), (0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-neutral-500 mt-0.5 leading-snug", children: item.description })] }, item.id)))] }, group))) }))] }));
42
+ }
43
+ //# sourceMappingURL=ExamplePicker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExamplePicker.js","sourceRoot":"","sources":["../../../src/react/ExamplePicker.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AAEb,iCAA6D;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 import type { ICompilerService } from "../structures/ICompilerService";
2
+ /**
3
+ * Renders the lint plugin's findings in a list view. Shown by `PlaygroundShell`
4
+ * when the active tab is "lint". Empty state is the green checkmark.
5
+ */
6
+ export declare function LintPane({ diagnostics, emptyHint, }: {
7
+ diagnostics: ICompilerService.IDiagnostic[];
8
+ emptyHint?: string;
9
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.LintPane = LintPane;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ /**
7
+ * Renders the lint plugin's findings in a list view. Shown by `PlaygroundShell`
8
+ * when the active tab is "lint". Empty state is the green checkmark.
9
+ */
10
+ function LintPane({ diagnostics, emptyHint = "Powered by @ttsc/lint inside playground.wasm.", }) {
11
+ if (diagnostics.length === 0)
12
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center h-full text-neutral-500 font-mono text-sm gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-emerald-400 text-xl", children: "\u2713" }), (0, jsx_runtime_1.jsx)("span", { children: "No lint diagnostics." }), (0, jsx_runtime_1.jsx)("span", { className: "text-[10px] text-neutral-600 max-w-xs text-center", children: emptyHint })] }));
13
+ return ((0, jsx_runtime_1.jsx)("div", { className: "overflow-auto h-full p-4 space-y-2", children: diagnostics.map((d, i) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex gap-3 p-3 rounded-md bg-neutral-900/60 border border-neutral-800/80", children: [(0, jsx_runtime_1.jsx)("span", { className: `mt-0.5 text-[10px] font-mono px-1.5 py-0.5 rounded shrink-0 ${d.severity === "error"
14
+ ? "text-red-300 bg-red-500/10"
15
+ : "text-yellow-300 bg-yellow-500/10"}`, children: d.severity }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 min-w-0", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-[11px] font-mono text-neutral-500 mb-1", children: [(0, jsx_runtime_1.jsx)("span", { children: d.code }), (0, jsx_runtime_1.jsx)("span", { children: "\u00B7" }), (0, jsx_runtime_1.jsxs)("span", { children: [d.line, ":", d.column] })] }), (0, jsx_runtime_1.jsx)("div", { className: "text-[13px] text-neutral-200 font-mono", children: d.message })] })] }, i))) }));
16
+ }
17
+ //# sourceMappingURL=LintPane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LintPane.js","sourceRoot":"","sources":["../../../src/react/LintPane.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AAIb;;;GAGG;AACH,kBAAyB,EACvB,WAAW,EACX,SAAS,GAAG,+CAA+C,GAI5D;IACC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAC1B,OAAO,CACL,iCAAK,SAAS,EAAC,2FAA2F,aACxG,iCAAM,SAAS,EAAC,0BAA0B,uBAAS,EACnD,oEAAiC,EACjC,iCAAM,SAAS,EAAC,mDAAmD,YAChE,SAAS,GACL,IACH,CACP,CAAC;IACJ,OAAO,CACL,gCAAK,SAAS,EAAC,oCAAoC,YAChD,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACzB,iCAEE,SAAS,EAAC,0EAA0E,aAEpF,iCACE,SAAS,EAAE,+DACT,CAAC,CAAC,QAAQ,KAAK,OAAO;wBACpB,CAAC,CAAC,4BAA4B;wBAC9B,CAAC,CAAC,kCACN,EAAE,YAED,CAAC,CAAC,QAAQ,GACN,EACP,iCAAK,SAAS,EAAC,gBAAgB,aAC7B,iCAAK,SAAS,EAAC,qEAAqE,aAClF,2CAAO,CAAC,CAAC,IAAI,GAAQ,EACrB,sDAAc,EACd,6CACG,CAAC,CAAC,IAAI,OAAG,CAAC,CAAC,MAAM,IACb,IACH,EACN,gCAAK,SAAS,EAAC,wCAAwC,YACpD,CAAC,CAAC,OAAO,GACN,IACF,KAvBD,CAAC,CAwBF,CACP,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { IOptionToggle } from "../structures/IOptionToggle";
2
+ import type { ITransformOptions } from "../structures/ITransformOptions";
3
+ interface OptionsPanelProps {
4
+ options: ITransformOptions;
5
+ onChange: (next: ITransformOptions) => void;
6
+ onClose: () => void;
7
+ /** Defaults to the typia + lint pair from `DEFAULT_OPTION_TOGGLES`. */
8
+ toggles?: readonly IOptionToggle[];
9
+ /** Dialog heading. Defaults to "Transform Options". */
10
+ title?: string;
11
+ }
12
+ export declare function OptionsPanel({ options, onChange, onClose, toggles, title, }: OptionsPanelProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};