@ttsc/playground 0.18.4 → 0.19.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 (43) hide show
  1. package/README.md +1 -1
  2. package/lib/src/compiler/createWorkerCompiler.js +7 -191
  3. package/lib/src/compiler/createWorkerCompiler.js.map +1 -1
  4. package/lib/src/compiler/internal/createWorkerCompilerService.d.ts +18 -0
  5. package/lib/src/compiler/internal/createWorkerCompilerService.js +272 -0
  6. package/lib/src/compiler/internal/createWorkerCompilerService.js.map +1 -0
  7. package/lib/src/npm/collectExternalPackageNames.js +253 -9
  8. package/lib/src/npm/collectExternalPackageNames.js.map +1 -1
  9. package/lib/src/react/ConsoleViewer.js +17 -17
  10. package/lib/src/react/ConsoleViewer.js.map +1 -1
  11. package/lib/src/react/DependencyProgressModal.js +1 -1
  12. package/lib/src/react/DependencyProgressModal.js.map +1 -1
  13. package/lib/src/react/DiagnosticsPanel.js +2 -2
  14. package/lib/src/react/DiagnosticsPanel.js.map +1 -1
  15. package/lib/src/react/ExamplePicker.js +2 -2
  16. package/lib/src/react/ExamplePicker.js.map +1 -1
  17. package/lib/src/react/LintPane.js +3 -3
  18. package/lib/src/react/LintPane.js.map +1 -1
  19. package/lib/src/react/OptionsPanel.js +1 -1
  20. package/lib/src/react/OptionsPanel.js.map +1 -1
  21. package/lib/src/react/PlaygroundShell.js +14 -13
  22. package/lib/src/react/PlaygroundShell.js.map +1 -1
  23. package/lib/src/react/ResultViewer.d.ts +2 -2
  24. package/lib/src/react/ResultViewer.js +3 -3
  25. package/lib/src/react/ResultViewer.js.map +1 -1
  26. package/lib/src/react/SourceEditor.js +1 -1
  27. package/lib/src/react/SourceEditor.js.map +1 -1
  28. package/lib/src/sandbox/createSandboxRequire.js +34 -9
  29. package/lib/src/sandbox/createSandboxRequire.js.map +1 -1
  30. package/package.json +3 -3
  31. package/src/compiler/createWorkerCompiler.ts +8 -236
  32. package/src/compiler/internal/createWorkerCompilerService.ts +358 -0
  33. package/src/npm/collectExternalPackageNames.ts +262 -9
  34. package/src/react/ConsoleViewer.tsx +18 -18
  35. package/src/react/DependencyProgressModal.tsx +11 -11
  36. package/src/react/DiagnosticsPanel.tsx +11 -11
  37. package/src/react/ExamplePicker.tsx +7 -7
  38. package/src/react/LintPane.tsx +5 -5
  39. package/src/react/OptionsPanel.tsx +10 -10
  40. package/src/react/PlaygroundShell.tsx +64 -74
  41. package/src/react/ResultViewer.tsx +4 -4
  42. package/src/react/SourceEditor.tsx +2 -3
  43. package/src/sandbox/createSandboxRequire.ts +32 -9
package/README.md CHANGED
@@ -188,4 +188,4 @@ If the wasm registers plugins other than typia / `@ttsc/lint`, pass `typiaPlugin
188
188
 
189
189
  ## Documents
190
190
 
191
- See the [`@ttsc/playground` guide](https://ttsc.dev/docs/playground) for the site-walkthrough version of this README.
191
+ See the [hosted playground guide](https://ttsc.dev/docs/ttsc/playground) for the consumer-facing tour of the ttsc.dev playground this package powers.
@@ -8,20 +8,13 @@ exports.createWorkerCompiler = createWorkerCompiler;
8
8
  // the site's chosen module shape, registers the typia/lint plugin verbs (or
9
9
  // the site-provided overrides), and serializes every MemFS-mutating call onto
10
10
  // a single chain so concurrent compiles never corrupt each other.
11
+ //
12
+ // The pipeline logic lives in `createWorkerCompilerService`, which takes the
13
+ // `@ttsc/wasm` boot / result-parsing functions as injected dependencies. This
14
+ // wrapper is the only place that imports them at runtime, so the service can be
15
+ // tested against a fake `IBootResult` without building or booting WASM.
11
16
  const wasm_1 = require("@ttsc/wasm");
12
- const DEFAULT_ENTRY_FILE_1 = require("./DEFAULT_ENTRY_FILE");
13
- const DEFAULT_LINT_PLUGIN_NAME_1 = require("./DEFAULT_LINT_PLUGIN_NAME");
14
- const DEFAULT_TSCONFIG_PATH_1 = require("./DEFAULT_TSCONFIG_PATH");
15
- const DEFAULT_TYPIA_PLUGIN_NAME_1 = require("./DEFAULT_TYPIA_PLUGIN_NAME");
16
- const DEFAULT_WORK_DIR_1 = require("./DEFAULT_WORK_DIR");
17
- const buildTsconfigJSON_1 = require("./buildTsconfigJSON");
18
- const installDependenciesIntoMemFS_1 = require("./installDependenciesIntoMemFS");
19
- const joinUnder_1 = require("./internal/joinUnder");
20
- const parseLintDiagnostics_1 = require("./internal/parseLintDiagnostics");
21
- const safeParseTypiaTransform_1 = require("./internal/safeParseTypiaTransform");
22
- const mapDiagnostic_1 = require("./mapDiagnostic");
23
- const normalizeError_1 = require("./normalizeError");
24
- const pickEmittedJS_1 = require("./pickEmittedJS");
17
+ const createWorkerCompilerService_1 = require("./internal/createWorkerCompilerService");
25
18
  /**
26
19
  * Build an `ICompilerService` ready to register with tgrid's `WorkerServer`.
27
20
  *
@@ -45,183 +38,6 @@ const pickEmittedJS_1 = require("./pickEmittedJS");
45
38
  * ```
46
39
  */
47
40
  function createWorkerCompiler(options) {
48
- const workDir = options.workDir ?? DEFAULT_WORK_DIR_1.DEFAULT_WORK_DIR;
49
- const tsconfigPath = options.tsconfigPath ?? DEFAULT_TSCONFIG_PATH_1.DEFAULT_TSCONFIG_PATH;
50
- const entryFile = options.entryFile ?? DEFAULT_ENTRY_FILE_1.DEFAULT_ENTRY_FILE;
51
- const typiaPlugin = options.typiaPlugin === false ? null : (options.typiaPlugin ?? {});
52
- const typiaPluginName = typiaPlugin?.name ?? DEFAULT_TYPIA_PLUGIN_NAME_1.DEFAULT_TYPIA_PLUGIN_NAME;
53
- const typiaTransformModule = typiaPlugin?.transformModule ?? "typia/lib/transform";
54
- const lintPlugin = options.lintPlugin === false ? null : (options.lintPlugin ?? {});
55
- const lintPluginName = lintPlugin?.name ?? DEFAULT_LINT_PLUGIN_NAME_1.DEFAULT_LINT_PLUGIN_NAME;
56
- // tsconfig variants. ESM for the "Compiled JS" preview lane, CommonJS for
57
- // the bundle/Execute lane (whose `new Function` driver expects CJS).
58
- const tsconfigPlugins = typiaPlugin
59
- ? [{ transform: typiaTransformModule }]
60
- : [];
61
- const extraCompilerOptions = {
62
- ...(options.extraCompilerOptions ?? {}),
63
- ...(tsconfigPlugins.length > 0 ? { plugins: tsconfigPlugins } : {}),
64
- };
65
- const tsconfigESM = (0, buildTsconfigJSON_1.buildTsconfigJSON)({
66
- module: "ESNext",
67
- compilerOptions: extraCompilerOptions,
68
- });
69
- const tsconfigCJS = (0, buildTsconfigJSON_1.buildTsconfigJSON)({
70
- module: "CommonJS",
71
- compilerOptions: extraCompilerOptions,
72
- });
73
- // Cache the boot promise across calls. If the boot rejects we clear the
74
- // cache so the next call retries — otherwise every later compile/bundle/
75
- // lint would replay the same rejection forever (page reload required).
76
- // Mirrors the createCompilerClient (UI-side) pattern.
77
- let boot = null;
78
- function getBoot() {
79
- if (boot)
80
- return boot;
81
- boot = (async () => {
82
- const result = await (0, wasm_1.bootTtsc)({
83
- wasmUrl: options.wasmUrl,
84
- wasmExecUrl: options.wasmExecUrl,
85
- apiName: options.apiName,
86
- });
87
- if (typiaPlugin?.mount)
88
- await typiaPlugin.mount(result.host, workDir);
89
- return result;
90
- })().catch((err) => {
91
- boot = null;
92
- throw err;
93
- });
94
- return boot;
95
- }
96
- // Serialize every MemFS-mutating call. tgrid queues incoming messages, but
97
- // the wasm-side host runs them concurrently — a fast keystroke could
98
- // interleave a bundle's tsconfig rewrite with a lint pass and corrupt
99
- // either result. The chain keeps compile/bundle/lint linear.
100
- let busy = Promise.resolve();
101
- const enqueue = (fn) => {
102
- const next = busy.then(fn, fn);
103
- busy = next.catch(() => { });
104
- return next;
105
- };
106
- const projectFiles = (source, tsconfigText) => ({
107
- [`${workDir}/${tsconfigPath}`]: tsconfigText,
108
- [`${workDir}/${entryFile}`]: source,
109
- });
110
- const writeProject = (host, files) => {
111
- for (const [path, text] of Object.entries(files)) {
112
- host.writeFile(path, text);
113
- }
114
- };
115
- // Typia transform — run the registered typia plugin's `transform` verb,
116
- // parse its JSON stdout, and write the rewritten TS back into MemFS so the
117
- // subsequent `api.build` sees the post-transform text.
118
- const applyTypiaTransform = async (api, host) => {
119
- if (!typiaPlugin)
120
- return;
121
- try {
122
- const raw = await api.plugin({
123
- name: typiaPluginName,
124
- command: "transform",
125
- cwd: workDir,
126
- tsconfig: tsconfigPath,
127
- output: "ts",
128
- });
129
- if (!raw.stdout)
130
- return;
131
- const transformed = (0, safeParseTypiaTransform_1.safeParseTypiaTransform)(raw.stdout);
132
- if (!transformed)
133
- return;
134
- for (const [rel, text] of Object.entries(transformed.typescript)) {
135
- host.writeFile((0, joinUnder_1.joinUnder)(workDir, rel), text);
136
- }
137
- }
138
- catch {
139
- // Swallow plugin spawn / JSON parse failures so the user still sees the
140
- // tsgo compile diagnostics from the subsequent build call. Real
141
- // user-facing errors (e.g. typia rule violations) flow through the
142
- // wasm-side diagnostics path.
143
- }
144
- };
145
- const runBuildPipeline = async (source, runTypia, tsconfigText) => {
146
- try {
147
- const { api, host } = await getBoot();
148
- writeProject(host, projectFiles(source, tsconfigText));
149
- if (runTypia)
150
- await applyTypiaTransform(api, host);
151
- const raw = await api.build({
152
- cwd: workDir,
153
- tsconfig: tsconfigPath,
154
- });
155
- if (raw.code !== 0 && !raw.result) {
156
- return {
157
- type: "error",
158
- target: "javascript",
159
- value: {
160
- message: raw.stderr || "ttsc: build failed without a result payload",
161
- },
162
- };
163
- }
164
- const parsed = (0, wasm_1.parseResult)(raw);
165
- if (!parsed) {
166
- return {
167
- type: "error",
168
- target: "javascript",
169
- value: { message: "ttsc: result JSON could not be parsed" },
170
- };
171
- }
172
- const diagnostics = (parsed.diagnostics ?? []).map((d) => (0, mapDiagnostic_1.mapDiagnostic)(d, source));
173
- const js = (0, pickEmittedJS_1.pickEmittedJS)(parsed.output ?? {}, entryFile);
174
- const errors = diagnostics.filter((d) => d.severity === "error");
175
- if (errors.length > 0) {
176
- return {
177
- type: "failure",
178
- target: "javascript",
179
- value: js ?? "",
180
- diagnostics,
181
- };
182
- }
183
- return { type: "success", target: "javascript", value: js ?? "" };
184
- }
185
- catch (error) {
186
- return {
187
- type: "error",
188
- target: "javascript",
189
- value: (0, normalizeError_1.normalizeError)(error),
190
- };
191
- }
192
- };
193
- // Lint pipeline. The lint plugin emits tsgo-style pretty diagnostics on
194
- // stderr; we parse those lines back into IDiagnostic so the UI can render
195
- // them in the Lint tab.
196
- const runLintPipeline = async (source) => {
197
- if (!lintPlugin)
198
- return { diagnostics: [] };
199
- try {
200
- const { api, host } = await getBoot();
201
- writeProject(host, projectFiles(source, tsconfigESM));
202
- const raw = await api.plugin({
203
- name: lintPluginName,
204
- command: "check",
205
- cwd: workDir,
206
- tsconfig: tsconfigPath,
207
- });
208
- return { diagnostics: (0, parseLintDiagnostics_1.parseLintDiagnostics)(raw.stderr, source) };
209
- }
210
- catch {
211
- return { diagnostics: [] };
212
- }
213
- };
214
- return {
215
- installDependencies: (props) => enqueue(async () => {
216
- const { host } = await getBoot();
217
- return (0, installDependenciesIntoMemFS_1.installDependenciesIntoMemFS)(host, workDir, props);
218
- }),
219
- compile: (props) => enqueue(() => runBuildPipeline(props.source, shouldRunTypia(props.options), tsconfigESM)),
220
- bundle: (props) => enqueue(() => runBuildPipeline(props.source, shouldRunTypia(props.options), tsconfigCJS)),
221
- lint: (props) => enqueue(() => runLintPipeline(props.source)),
222
- };
223
- }
224
- function shouldRunTypia(options) {
225
- return options?.typia !== false;
41
+ return (0, createWorkerCompilerService_1.createWorkerCompilerService)({ bootTtsc: wasm_1.bootTtsc, parseResult: wasm_1.parseResult }, options);
226
42
  }
227
43
  //# sourceMappingURL=createWorkerCompiler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createWorkerCompiler.js","sourceRoot":"","sources":["../../../src/compiler/createWorkerCompiler.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAC3C,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAC5E,4EAA4E;AAC5E,8EAA8E;AAC9E,kEAAkE;AAClE,qCAKoB;AAKpB,6DAA0D;AAC1D,yEAAsE;AACtE,mEAAgE;AAChE,2EAAwE;AACxE,yDAAsD;AACtD,2DAAwD;AACxD,iFAA8E;A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;AAC9E,gFAAgF;AAChF,wEAAwE;AACxE,qCAAmD;AAInD,wFAAqF;AAErF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,8BACE,OAAqC;IAErC,OAAO,IAAA,yDAA2B,EAAC,EAAE,QAAQ,EAAR,eAAQ,EAAE,WAAW,EAAX,kBAAW,EAAE,EAAE,OAAO,CAAC,CAAC;AACzE,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { IBootResult, IBootTtscOptions, ITtscResult } from "@ttsc/wasm";
2
+ import type { ICompilerService } from "../../structures/ICompilerService";
3
+ import type { ICreateWorkerCompilerOptions } from "../../structures/ICreateWorkerCompilerOptions";
4
+ /**
5
+ * Runtime `@ttsc/wasm` collaborators the worker compiler needs. The public
6
+ * `createWorkerCompiler` binds the real implementations; tests bind fakes that
7
+ * resolve a synthetic `IBootResult` so the plugin-envelope handling can be
8
+ * verified without a real WASM boot.
9
+ */
10
+ export interface IWorkerCompilerDeps {
11
+ bootTtsc: (options: IBootTtscOptions) => Promise<IBootResult>;
12
+ parseResult: <T>(result: ITtscResult) => T | null;
13
+ }
14
+ /**
15
+ * Dependency-injected worker `ICompilerService` factory. See
16
+ * `createWorkerCompiler` for the public entry documentation.
17
+ */
18
+ export declare function createWorkerCompilerService(deps: IWorkerCompilerDeps, options: ICreateWorkerCompilerOptions): ICompilerService;
@@ -0,0 +1,272 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createWorkerCompilerService = createWorkerCompilerService;
4
+ const DEFAULT_ENTRY_FILE_1 = require("../DEFAULT_ENTRY_FILE");
5
+ const DEFAULT_LINT_PLUGIN_NAME_1 = require("../DEFAULT_LINT_PLUGIN_NAME");
6
+ const DEFAULT_TSCONFIG_PATH_1 = require("../DEFAULT_TSCONFIG_PATH");
7
+ const DEFAULT_TYPIA_PLUGIN_NAME_1 = require("../DEFAULT_TYPIA_PLUGIN_NAME");
8
+ const DEFAULT_WORK_DIR_1 = require("../DEFAULT_WORK_DIR");
9
+ const buildTsconfigJSON_1 = require("../buildTsconfigJSON");
10
+ const installDependenciesIntoMemFS_1 = require("../installDependenciesIntoMemFS");
11
+ const mapDiagnostic_1 = require("../mapDiagnostic");
12
+ const normalizeError_1 = require("../normalizeError");
13
+ const pickEmittedJS_1 = require("../pickEmittedJS");
14
+ const joinUnder_1 = require("./joinUnder");
15
+ const parseLintDiagnostics_1 = require("./parseLintDiagnostics");
16
+ const safeParseTypiaTransform_1 = require("./safeParseTypiaTransform");
17
+ /**
18
+ * Dependency-injected worker `ICompilerService` factory. See
19
+ * `createWorkerCompiler` for the public entry documentation.
20
+ */
21
+ function createWorkerCompilerService(deps, options) {
22
+ const workDir = options.workDir ?? DEFAULT_WORK_DIR_1.DEFAULT_WORK_DIR;
23
+ const tsconfigPath = options.tsconfigPath ?? DEFAULT_TSCONFIG_PATH_1.DEFAULT_TSCONFIG_PATH;
24
+ const entryFile = options.entryFile ?? DEFAULT_ENTRY_FILE_1.DEFAULT_ENTRY_FILE;
25
+ const typiaPlugin = options.typiaPlugin === false ? null : (options.typiaPlugin ?? {});
26
+ const typiaPluginName = typiaPlugin?.name ?? DEFAULT_TYPIA_PLUGIN_NAME_1.DEFAULT_TYPIA_PLUGIN_NAME;
27
+ const typiaTransformModule = typiaPlugin?.transformModule ?? "typia/lib/transform";
28
+ const lintPlugin = options.lintPlugin === false ? null : (options.lintPlugin ?? {});
29
+ const lintPluginName = lintPlugin?.name ?? DEFAULT_LINT_PLUGIN_NAME_1.DEFAULT_LINT_PLUGIN_NAME;
30
+ // tsconfig variants. ESM for the "Compiled JS" preview lane, CommonJS for
31
+ // the bundle/Execute lane (whose `new Function` driver expects CJS).
32
+ const tsconfigPlugins = typiaPlugin
33
+ ? [{ transform: typiaTransformModule }]
34
+ : [];
35
+ const extraCompilerOptions = {
36
+ ...(options.extraCompilerOptions ?? {}),
37
+ ...(tsconfigPlugins.length > 0 ? { plugins: tsconfigPlugins } : {}),
38
+ };
39
+ const tsconfigESM = (0, buildTsconfigJSON_1.buildTsconfigJSON)({
40
+ module: "ESNext",
41
+ compilerOptions: extraCompilerOptions,
42
+ });
43
+ const tsconfigCJS = (0, buildTsconfigJSON_1.buildTsconfigJSON)({
44
+ module: "CommonJS",
45
+ compilerOptions: extraCompilerOptions,
46
+ });
47
+ // Cache the boot promise across calls. If the boot rejects we clear the
48
+ // cache so the next call retries — otherwise every later compile/bundle/
49
+ // lint would replay the same rejection forever (page reload required).
50
+ // Mirrors the createCompilerClient (UI-side) pattern.
51
+ let boot = null;
52
+ function getBoot() {
53
+ if (boot)
54
+ return boot;
55
+ boot = (async () => {
56
+ const result = await deps.bootTtsc({
57
+ wasmUrl: options.wasmUrl,
58
+ wasmExecUrl: options.wasmExecUrl,
59
+ apiName: options.apiName,
60
+ });
61
+ if (typiaPlugin?.mount)
62
+ await typiaPlugin.mount(result.host, workDir);
63
+ return result;
64
+ })().catch((err) => {
65
+ boot = null;
66
+ throw err;
67
+ });
68
+ return boot;
69
+ }
70
+ // Serialize every MemFS-mutating call. tgrid queues incoming messages, but
71
+ // the wasm-side host runs them concurrently — a fast keystroke could
72
+ // interleave a bundle's tsconfig rewrite with a lint pass and corrupt
73
+ // either result. The chain keeps compile/bundle/lint linear.
74
+ let busy = Promise.resolve();
75
+ const enqueue = (fn) => {
76
+ const next = busy.then(fn, fn);
77
+ busy = next.catch(() => { });
78
+ return next;
79
+ };
80
+ const projectFiles = (source, tsconfigText) => ({
81
+ [`${workDir}/${tsconfigPath}`]: tsconfigText,
82
+ [`${workDir}/${entryFile}`]: source,
83
+ });
84
+ const writeProject = (host, files) => {
85
+ for (const [path, text] of Object.entries(files)) {
86
+ host.writeFile(path, text);
87
+ }
88
+ };
89
+ // Typia transform — run the registered typia plugin's `transform` verb,
90
+ // parse its JSON stdout, and write the rewritten TS back into MemFS so the
91
+ // subsequent `api.build` sees the post-transform text.
92
+ //
93
+ // A configured transform that does not complete successfully is a failure,
94
+ // NOT a silent fall-through to compiling the original source: a nonzero
95
+ // process envelope, a rejected call, or output that cannot be parsed all
96
+ // return `{ ok: false }` so `runBuildPipeline` surfaces the failure instead
97
+ // of emitting untransformed JavaScript.
98
+ const applyTypiaTransform = async (api, host) => {
99
+ if (!typiaPlugin)
100
+ return { ok: true };
101
+ let raw;
102
+ try {
103
+ raw = await api.plugin({
104
+ name: typiaPluginName,
105
+ command: "transform",
106
+ cwd: workDir,
107
+ tsconfig: tsconfigPath,
108
+ output: "ts",
109
+ });
110
+ }
111
+ catch (error) {
112
+ return { ok: false, message: messageOf(error) };
113
+ }
114
+ if (raw.code !== 0) {
115
+ return {
116
+ ok: false,
117
+ message: pluginFailureMessage(raw, typiaPluginName, "transform"),
118
+ };
119
+ }
120
+ // Success with no payload: nothing to rewrite, let the build run as-is.
121
+ if (!raw.stdout)
122
+ return { ok: true };
123
+ const transformed = (0, safeParseTypiaTransform_1.safeParseTypiaTransform)(raw.stdout);
124
+ if (!transformed) {
125
+ return {
126
+ ok: false,
127
+ message: `ttsc: ${typiaPluginName} transform produced unparseable output`,
128
+ };
129
+ }
130
+ for (const [rel, text] of Object.entries(transformed.typescript)) {
131
+ host.writeFile((0, joinUnder_1.joinUnder)(workDir, rel), text);
132
+ }
133
+ return { ok: true };
134
+ };
135
+ const runBuildPipeline = async (source, runTypia, tsconfigText) => {
136
+ try {
137
+ const { api, host } = await getBoot();
138
+ writeProject(host, projectFiles(source, tsconfigText));
139
+ if (runTypia) {
140
+ const outcome = await applyTypiaTransform(api, host);
141
+ if (!outcome.ok) {
142
+ return {
143
+ type: "error",
144
+ target: "javascript",
145
+ value: { message: outcome.message },
146
+ };
147
+ }
148
+ }
149
+ const raw = await api.build({
150
+ cwd: workDir,
151
+ tsconfig: tsconfigPath,
152
+ });
153
+ if (raw.code !== 0 && !raw.result) {
154
+ return {
155
+ type: "error",
156
+ target: "javascript",
157
+ value: {
158
+ message: raw.stderr || "ttsc: build failed without a result payload",
159
+ },
160
+ };
161
+ }
162
+ const parsed = deps.parseResult(raw);
163
+ if (!parsed) {
164
+ return {
165
+ type: "error",
166
+ target: "javascript",
167
+ value: { message: "ttsc: result JSON could not be parsed" },
168
+ };
169
+ }
170
+ const diagnostics = (parsed.diagnostics ?? []).map((d) => (0, mapDiagnostic_1.mapDiagnostic)(d, source));
171
+ const js = (0, pickEmittedJS_1.pickEmittedJS)(parsed.output ?? {}, entryFile);
172
+ const errors = diagnostics.filter((d) => d.severity === "error");
173
+ if (errors.length > 0) {
174
+ return {
175
+ type: "failure",
176
+ target: "javascript",
177
+ value: js ?? "",
178
+ diagnostics,
179
+ };
180
+ }
181
+ return { type: "success", target: "javascript", value: js ?? "" };
182
+ }
183
+ catch (error) {
184
+ return {
185
+ type: "error",
186
+ target: "javascript",
187
+ value: (0, normalizeError_1.normalizeError)(error),
188
+ };
189
+ }
190
+ };
191
+ // Lint pipeline. The lint plugin emits tsgo-style pretty diagnostics on
192
+ // stderr; we parse those lines back into IDiagnostic so the UI can render
193
+ // them in the Lint tab.
194
+ //
195
+ // A finished lint run reports its findings the same way whether the process
196
+ // exited 0 or nonzero (a linter exits nonzero when it finds violations), so
197
+ // parsed diagnostics are always returned as-is. But a plugin that failed to
198
+ // run — a rejected call, or a nonzero exit whose stderr yields no diagnostic
199
+ // — must NOT collapse into an empty (clean) result; it surfaces a single
200
+ // error diagnostic so the failure stays visible.
201
+ const runLintPipeline = async (source) => {
202
+ if (!lintPlugin)
203
+ return { diagnostics: [] };
204
+ let raw;
205
+ try {
206
+ const { api, host } = await getBoot();
207
+ writeProject(host, projectFiles(source, tsconfigESM));
208
+ raw = await api.plugin({
209
+ name: lintPluginName,
210
+ command: "check",
211
+ cwd: workDir,
212
+ tsconfig: tsconfigPath,
213
+ });
214
+ }
215
+ catch (error) {
216
+ return { diagnostics: [pluginFailureDiagnostic(messageOf(error))] };
217
+ }
218
+ const diagnostics = (0, parseLintDiagnostics_1.parseLintDiagnostics)(raw.stderr, source);
219
+ if (diagnostics.length === 0 && raw.code !== 0) {
220
+ return {
221
+ diagnostics: [
222
+ pluginFailureDiagnostic(pluginFailureMessage(raw, lintPluginName, "check")),
223
+ ],
224
+ };
225
+ }
226
+ return { diagnostics };
227
+ };
228
+ return {
229
+ installDependencies: (props) => enqueue(async () => {
230
+ const { host } = await getBoot();
231
+ return (0, installDependenciesIntoMemFS_1.installDependenciesIntoMemFS)(host, workDir, props);
232
+ }),
233
+ compile: (props) => enqueue(() => runBuildPipeline(props.source, shouldRunTypia(props.options), tsconfigESM)),
234
+ bundle: (props) => enqueue(() => runBuildPipeline(props.source, shouldRunTypia(props.options), tsconfigCJS)),
235
+ lint: (props) => enqueue(() => runLintPipeline(props.source)),
236
+ };
237
+ }
238
+ function shouldRunTypia(options) {
239
+ return options?.typia !== false;
240
+ }
241
+ /** Human-readable message for a nonzero plugin process envelope. */
242
+ function pluginFailureMessage(raw, name, verb) {
243
+ return (raw.stderr.trim() ||
244
+ raw.stdout.trim() ||
245
+ `ttsc: ${name} ${verb} plugin failed (exit code ${raw.code})`);
246
+ }
247
+ /** Message of a rejected plugin call. */
248
+ function messageOf(error) {
249
+ if (error instanceof Error)
250
+ return error.message;
251
+ if (error &&
252
+ typeof error === "object" &&
253
+ "message" in error)
254
+ return String(error.message);
255
+ return String(error);
256
+ }
257
+ /**
258
+ * A synthetic error diagnostic representing a lint plugin that failed to run.
259
+ * Anchored at the start of the source so it renders like any other finding and
260
+ * keeps the lint result non-empty (never a false "clean" report).
261
+ */
262
+ function pluginFailureDiagnostic(message) {
263
+ return {
264
+ line: 1,
265
+ column: 1,
266
+ length: 1,
267
+ severity: "error",
268
+ message,
269
+ code: "PLUGIN",
270
+ };
271
+ }
272
+ //# sourceMappingURL=createWorkerCompilerService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createWorkerCompilerService.js","sourceRoot":"","sources":["../../../../src/compiler/internal/createWorkerCompilerService.ts"],"names":[],"mappings":";;;AAkBA,8DAA2D;AAC3D,0EAAuE;AACvE,oEAAiE;AACjE,4EAAyE;AACzE,0DAAuD;AACvD,4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