ttsc 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +75 -66
  2. package/cmd/ttsc/api_compile.go +5 -1
  3. package/driver/program.go +23 -1
  4. package/driver/rewrite.go +126 -9
  5. package/driver/rewrite_test.go +52 -0
  6. package/lib/TtscCompiler.js +28 -46
  7. package/lib/TtscCompiler.js.map +1 -1
  8. package/lib/compiler/internal/buildNativeCompiler.js +8 -38
  9. package/lib/compiler/internal/buildNativeCompiler.js.map +1 -1
  10. package/lib/compiler/internal/compileProjectInMemory.js +36 -63
  11. package/lib/compiler/internal/compileProjectInMemory.js.map +1 -1
  12. package/lib/compiler/internal/project/readProjectConfig.js +108 -60
  13. package/lib/compiler/internal/project/readProjectConfig.js.map +1 -1
  14. package/lib/compiler/internal/project/resolveProjectConfig.js +15 -45
  15. package/lib/compiler/internal/project/resolveProjectConfig.js.map +1 -1
  16. package/lib/compiler/internal/resolveBinary.js +10 -40
  17. package/lib/compiler/internal/resolveBinary.js.map +1 -1
  18. package/lib/compiler/internal/resolveEmittedJavaScript.js +21 -48
  19. package/lib/compiler/internal/resolveEmittedJavaScript.js.map +1 -1
  20. package/lib/compiler/internal/resolveTsgo.js +14 -44
  21. package/lib/compiler/internal/resolveTsgo.js.map +1 -1
  22. package/lib/compiler/internal/runBuild.d.ts +7 -0
  23. package/lib/compiler/internal/runBuild.js +47 -66
  24. package/lib/compiler/internal/runBuild.js.map +1 -1
  25. package/lib/compiler/internal/runSingleFileEmit.js +18 -48
  26. package/lib/compiler/internal/runSingleFileEmit.js.map +1 -1
  27. package/lib/compiler/internal/transformProjectInMemory.js +41 -75
  28. package/lib/compiler/internal/transformProjectInMemory.js.map +1 -1
  29. package/lib/launcher/internal/getCompilerVersionText.js +7 -37
  30. package/lib/launcher/internal/getCompilerVersionText.js.map +1 -1
  31. package/lib/launcher/internal/prepareExecution.js +48 -69
  32. package/lib/launcher/internal/prepareExecution.js.map +1 -1
  33. package/lib/launcher/internal/runTtsc.js +53 -64
  34. package/lib/launcher/internal/runTtsc.js.map +1 -1
  35. package/lib/launcher/internal/runTtsx.js +328 -57
  36. package/lib/launcher/internal/runTtsx.js.map +1 -1
  37. package/lib/plugin/internal/buildSourcePlugin.d.ts +8 -0
  38. package/lib/plugin/internal/buildSourcePlugin.js +179 -125
  39. package/lib/plugin/internal/buildSourcePlugin.js.map +1 -1
  40. package/lib/plugin/internal/loadProjectPlugins.d.ts +2 -0
  41. package/lib/plugin/internal/loadProjectPlugins.js +197 -9
  42. package/lib/plugin/internal/loadProjectPlugins.js.map +1 -1
  43. package/lib/structures/ITtscCompilerContext.d.ts +16 -3
  44. package/lib/structures/ITtscCompilerResult.d.ts +4 -0
  45. package/lib/structures/ITtscCompilerTransformation.d.ts +2 -0
  46. package/lib/structures/ITtscPluginFactoryContext.d.ts +6 -3
  47. package/lib/structures/ITtscProjectPluginConfig.d.ts +8 -7
  48. package/lib/structures/internal/ITtscParsedProjectConfig.d.ts +2 -0
  49. package/lib/structures/internal/ITtscProjectLocatorOptions.d.ts +2 -0
  50. package/lib/structures/internal/TtscCommonOptions.d.ts +2 -0
  51. package/package.json +9 -14
  52. package/shim/diagnosticwriter/lint.go +8 -0
  53. package/src/TtscCompiler.ts +20 -5
  54. package/src/compiler/internal/buildNativeCompiler.ts +2 -2
  55. package/src/compiler/internal/compileProjectInMemory.ts +21 -16
  56. package/src/compiler/internal/project/readProjectConfig.ts +134 -35
  57. package/src/compiler/internal/project/resolveProjectConfig.ts +2 -2
  58. package/src/compiler/internal/resolveBinary.ts +2 -2
  59. package/src/compiler/internal/resolveEmittedJavaScript.ts +11 -7
  60. package/src/compiler/internal/resolveTsgo.ts +2 -2
  61. package/src/compiler/internal/runBuild.ts +34 -21
  62. package/src/compiler/internal/runSingleFileEmit.ts +3 -3
  63. package/src/compiler/internal/transformProjectInMemory.ts +37 -37
  64. package/src/launcher/internal/getCompilerVersionText.ts +2 -2
  65. package/src/launcher/internal/prepareExecution.ts +14 -4
  66. package/src/launcher/internal/runTtsc.ts +30 -4
  67. package/src/launcher/internal/runTtsx.ts +377 -26
  68. package/src/plugin/internal/buildSourcePlugin.ts +127 -32
  69. package/src/plugin/internal/loadProjectPlugins.ts +266 -10
  70. package/src/structures/ITtscCompilerContext.ts +17 -3
  71. package/src/structures/ITtscCompilerResult.ts +5 -0
  72. package/src/structures/ITtscCompilerTransformation.ts +3 -0
  73. package/src/structures/ITtscPluginFactoryContext.ts +6 -3
  74. package/src/structures/ITtscProjectPluginConfig.ts +8 -7
  75. package/src/structures/internal/ITtscParsedProjectConfig.ts +2 -0
  76. package/src/structures/internal/ITtscProjectLocatorOptions.ts +2 -0
  77. package/src/structures/internal/TtscCommonOptions.ts +2 -0
  78. package/utility/host.go +610 -18
  79. package/utility/host_test.go +162 -0
  80. package/test/compiler.test.ts +0 -422
  81. package/test/platform.test.ts +0 -12
  82. package/test/project.test.ts +0 -197
  83. package/test/source-build.test.ts +0 -45
  84. package/test/tsgo.test.ts +0 -69
package/README.md CHANGED
@@ -9,23 +9,27 @@
9
9
  [![Guide Documents](https://img.shields.io/badge/Guide-Documents-forestgreen)](https://github.com/samchon/ttsc/tree/master/docs)
10
10
  [![Discord Badge](https://img.shields.io/badge/discord-samchon-d91965?style=flat&labelColor=5866f2&logo=discord&logoColor=white&link=https://discord.gg/E94XhzrUCZ)](https://discord.gg/E94XhzrUCZ)
11
11
 
12
- A `typescript-go` toolchain for compiler-powered transforms and type-safe execution.
12
+ A `typescript-go` toolchain for compiler-powered plugins and type-safe execution.
13
13
 
14
14
  - **`ttsc`**: build, check, and transform.
15
15
  - **`ttsx`**: execute TypeScript with type checking.
16
- - 10x faster than `ts-node`.
16
+ - native TypeScript-Go execution instead of transpile-only runners.
17
17
  - type checking that `tsx` does not provide.
18
- - **transformer support**: compiler-powered libraries, such as `typia`.
18
+ - **plugin support**: compiler-powered libraries, such as `typia`.
19
19
  - `@ttsc/lint`: lint violations as TS compile errors.
20
20
 
21
21
  ## Setup
22
22
 
23
+ ### Install
24
+
23
25
  Install the native TypeScript preview package with `ttsc`:
24
26
 
25
27
  ```bash
26
- npm i -D ttsc @typescript/native-preview
28
+ npm install -D ttsc @typescript/native-preview
27
29
  ```
28
30
 
31
+ ### Commands
32
+
29
33
  Run TypeScript directly with `ttsx` (CLI command):
30
34
 
31
35
  ```bash
@@ -40,37 +44,46 @@ npx ttsc --noEmit
40
44
  npx ttsc --watch
41
45
  ```
42
46
 
43
- Prebuild or clear cached source-plugin binaries:
47
+ ### Bundlers
48
+
49
+ Use `@ttsc/unplugin` when a bundler owns your build.
50
+
51
+ It runs `ttsc` plugins inside supported bundlers.
44
52
 
45
53
  ```bash
46
- npx ttsc prepare
47
- npx ttsc clean
54
+ npm install -D ttsc @typescript/native-preview
55
+ npm install -D @ttsc/unplugin
48
56
  ```
49
57
 
50
- ## Plugin Configuration
51
-
52
- Add plugin entries under `compilerOptions.plugins` in your `tsconfig.json`.
53
-
54
- ```json
55
- {
56
- "compilerOptions": {
57
- "plugins": [
58
- {
59
- "transform": "@ttsc/lint",
60
- "config": {
61
- "no-var": "error",
62
- "no-explicit-any": "warning",
63
- "no-non-null-assertion": "off"
64
- }
65
- },
66
- { "transform": "@ttsc/paths" },
67
- { "transform": "typia/lib/transform" }
68
- ]
69
- }
70
- }
58
+ Minimal Vite setup:
59
+
60
+ ```ts
61
+ // vite.config.ts
62
+ import ttsc from "@ttsc/unplugin/vite";
63
+ import { defineConfig } from "vite";
64
+
65
+ export default defineConfig({
66
+ plugins: [ttsc()],
67
+ });
71
68
  ```
72
69
 
73
- The same configuration is used by both `ttsc` and `ttsx` commands.
70
+ Supported bundlers:
71
+
72
+ - Vite
73
+ - Rollup
74
+ - Rolldown
75
+ - esbuild
76
+ - Webpack
77
+ - Rspack
78
+ - Next.js
79
+ - Farm
80
+ - Bun
81
+
82
+ See [`@ttsc/unplugin`](https://github.com/samchon/ttsc/tree/master/packages/unplugin) for full setup and adapter options.
83
+
84
+ ## Plugins
85
+
86
+ Plugins let libraries add compile-time checks, transforms, and type-driven code generation to normal `ttsc` and `ttsx` runs.
74
87
 
75
88
  ```bash
76
89
  # compile
@@ -80,9 +93,7 @@ npx ttsc
80
93
  npx ttsx src/index.ts
81
94
  ```
82
95
 
83
- This gives compiler-powered libraries one transform path for both build-time and runtime execution.
84
-
85
- ## What Is a Transform?
96
+ ### Transform Example
86
97
 
87
98
  A transform uses TypeScript types to generate JavaScript before runtime.
88
99
 
@@ -107,50 +118,48 @@ interface IMember {
107
118
  }
108
119
  ```
109
120
 
110
- It is transformed into dedicated JavaScript:
111
-
112
- > ```js
113
- > import typia from "typia";
114
- > import * as __typia_transform__isFormatEmail from "typia/lib/internal/_isFormatEmail";
115
- > import * as __typia_transform__isFormatUuid from "typia/lib/internal/_isFormatUuid";
116
- > import * as __typia_transform__isTypeUint32 from "typia/lib/internal/_isTypeUint32";
117
- > import { v4 } from "uuid";
118
- >
119
- > const matched = (() => {
120
- > const _io0 = (input) =>
121
- > "string" === typeof input.id &&
122
- > __typia_transform__isFormatUuid._isFormatUuid(input.id) &&
123
- > "string" === typeof input.email &&
124
- > __typia_transform__isFormatEmail._isFormatEmail(input.email) &&
125
- > "number" === typeof input.age &&
126
- > __typia_transform__isTypeUint32._isTypeUint32(input.age) &&
127
- > 19 < input.age &&
128
- > input.age <= 100;
129
- > return (input) => "object" === typeof input && null !== input && _io0(input);
130
- > })()({
131
- > id: v4(),
132
- > email: "samchon.github@gmail.com",
133
- > age: 30,
134
- > });
135
- > console.log(matched); // true
136
- > ```
137
-
138
- `ttsc` applies this transform at build time; `ttsx` applies the same transform when running the file.
139
-
140
- ## List of Plugins
121
+ The transform replaces `typia.is<IMember>()` with dedicated JavaScript checks at build time:
122
+
123
+ ```js
124
+ import * as __typia_transform__isFormatUuid from "typia/lib/internal/_isFormatUuid";
125
+ import * as __typia_transform__isFormatEmail from "typia/lib/internal/_isFormatEmail";
126
+ import * as __typia_transform__isTypeUint32 from "typia/lib/internal/_isTypeUint32";
127
+ import typia from "typia";
128
+ import { v4 } from "uuid";
129
+ const matched = (() => {
130
+ const _io0 = (input) =>
131
+ "string" === typeof input.id &&
132
+ __typia_transform__isFormatUuid._isFormatUuid(input.id) &&
133
+ "string" === typeof input.email &&
134
+ __typia_transform__isFormatEmail._isFormatEmail(input.email) &&
135
+ "number" === typeof input.age &&
136
+ __typia_transform__isTypeUint32._isTypeUint32(input.age) &&
137
+ 19 < input.age &&
138
+ input.age <= 100;
139
+ return (input) => "object" === typeof input && null !== input && _io0(input);
140
+ })()({
141
+ id: v4(),
142
+ email: "samchon.github@gmail.com",
143
+ age: 30,
144
+ });
145
+ console.log(matched); // true
146
+ ```
147
+
148
+ ### List of Plugins
141
149
 
142
150
  `ttsc` ships a few small utility plugins in this repository.
143
151
 
144
- - [`@ttsc/banner`](https://github.com/samchon/ttsc/tree/master/packages/banner): adds `@packageDocumentation` JSDoc banners through source preamble insertion.
145
- - [`@ttsc/lint`](https://github.com/samchon/ttsc/tree/master/packages/lint): type-check + lint in one compile pass, ~20x faster than `eslint` in theory.
152
+ - [`@ttsc/banner`](https://github.com/samchon/ttsc/tree/master/packages/banner): adds `@packageDocumentation` JSDoc banners.
153
+ - [`@ttsc/lint`](https://github.com/samchon/ttsc/tree/master/packages/lint): reports lint violations as TypeScript compile errors.
146
154
  - [`@ttsc/paths`](https://github.com/samchon/ttsc/tree/master/packages/paths): rewrites source path aliases so JS and declaration emit receive relative imports.
147
155
  - [`@ttsc/strip`](https://github.com/samchon/ttsc/tree/master/packages/strip): removes configured calls and `debugger` statements.
156
+ - [`@ttsc/unplugin`](https://github.com/samchon/ttsc/tree/master/packages/unplugin): runs `ttsc` plugins inside bundlers supported by `unplugin`.
148
157
 
149
158
  Plugin authors should start from the [`Guide Documents`](https://github.com/samchon/ttsc/tree/master/docs).
150
159
 
151
160
  Ecosystem plugins are listed below; PRs adding `ttsc` plugins are welcome.
152
161
 
153
- - [`@nestia/core`](https://github.com/samchon/nestia): generates NestJS routes, OpenAPI, and SDKs.
162
+ - [`nestia`](https://github.com/samchon/nestia): generates NestJS routes, OpenAPI, and SDKs.
154
163
  - [`typia`](https://github.com/samchon/typia): generates validators, serializers, and type-driven runtime code.
155
164
 
156
165
  ## References
@@ -144,8 +144,12 @@ func toAPICompileDiagnostic(diag driver.Diagnostic) apiCompileDiagnostic {
144
144
  func apiOutputKey(cwd, fileName string) string {
145
145
  // Relative keys are the API contract for files inside the project. Absolute
146
146
  // keys are preserved for uncommon compiler outputs outside cwd.
147
- if rel, err := filepath.Rel(cwd, fileName); err == nil && !strings.HasPrefix(rel, "..") {
147
+ if rel, err := filepath.Rel(cwd, fileName); err == nil && !isOutsideRelativePath(rel) {
148
148
  return filepath.ToSlash(rel)
149
149
  }
150
150
  return filepath.ToSlash(fileName)
151
151
  }
152
+
153
+ func isOutsideRelativePath(rel string) bool {
154
+ return rel == ".." || strings.HasPrefix(rel, ".."+string(filepath.Separator))
155
+ }
package/driver/program.go CHANGED
@@ -343,7 +343,7 @@ func (fs sourcePreambleFS) ReadFile(filePath string) (string, bool) {
343
343
  if !ok || !isSourcePreambleTarget(filePath) {
344
344
  return contents, ok
345
345
  }
346
- return fs.preamble + contents, true
346
+ return ApplySourcePreamble(contents, fs.preamble), true
347
347
  }
348
348
 
349
349
  func (fs sourcePreambleFS) WriteFile(filePath string, data string) error {
@@ -377,6 +377,28 @@ func isSourcePreambleTarget(filePath string) bool {
377
377
  return false
378
378
  }
379
379
 
380
+ // ApplySourcePreamble inserts a generated source preamble without moving the
381
+ // file's BOM or hashbang away from the first bytes of the physical output.
382
+ func ApplySourcePreamble(text string, preamble string) string {
383
+ if preamble == "" {
384
+ return text
385
+ }
386
+ bom := ""
387
+ rest := text
388
+ if strings.HasPrefix(rest, "\ufeff") {
389
+ bom = "\ufeff"
390
+ rest = strings.TrimPrefix(rest, "\ufeff")
391
+ }
392
+ if strings.HasPrefix(rest, "#!") {
393
+ end := strings.IndexByte(rest, '\n')
394
+ if end < 0 {
395
+ return bom + rest + "\n" + preamble
396
+ }
397
+ return bom + rest[:end+1] + preamble + rest[end+1:]
398
+ }
399
+ return bom + preamble + rest
400
+ }
401
+
380
402
  // SourceFiles exposes the program's user-authored source files (declaration
381
403
  // files filtered out).
382
404
  func (p *Program) SourceFiles() []*ast.SourceFile {
package/driver/rewrite.go CHANGED
@@ -316,26 +316,143 @@ func matchParen(text string, pos int) (int, bool) {
316
316
  return 0, false
317
317
  }
318
318
  depth := 1
319
+ lastSignificant := byte('(')
319
320
  for i := pos + 1; i < len(text); i++ {
320
- switch text[i] {
321
+ ch := text[i]
322
+ switch ch {
323
+ case ' ', '\t', '\n', '\r', '\f':
324
+ continue
321
325
  case '(':
322
326
  depth++
327
+ lastSignificant = ch
323
328
  case ')':
324
329
  depth--
325
330
  if depth == 0 {
326
331
  return i, true
327
332
  }
328
- case '"', '\'', '`':
329
- q := text[i]
330
- j := i + 1
331
- for j < len(text) && text[j] != q {
332
- if text[j] == '\\' {
333
- j++
333
+ lastSignificant = ch
334
+ case '"', '\'':
335
+ end, ok := skipQuoted(text, i, ch)
336
+ if !ok {
337
+ return 0, false
338
+ }
339
+ i = end
340
+ lastSignificant = 'x'
341
+ case '`':
342
+ end, ok := skipTemplate(text, i)
343
+ if !ok {
344
+ return 0, false
345
+ }
346
+ i = end
347
+ lastSignificant = 'x'
348
+ case '/':
349
+ if i+1 < len(text) {
350
+ switch text[i+1] {
351
+ case '/':
352
+ i = skipLineComment(text, i+2)
353
+ continue
354
+ case '*':
355
+ end, ok := skipBlockComment(text, i+2)
356
+ if !ok {
357
+ return 0, false
358
+ }
359
+ i = end
360
+ continue
361
+ }
362
+ }
363
+ if canStartRegexLiteral(lastSignificant) {
364
+ end, ok := skipRegexLiteral(text, i)
365
+ if !ok {
366
+ return 0, false
334
367
  }
335
- j++
368
+ i = end
369
+ lastSignificant = 'x'
370
+ continue
371
+ }
372
+ lastSignificant = ch
373
+ default:
374
+ lastSignificant = ch
375
+ }
376
+ }
377
+ return 0, false
378
+ }
379
+
380
+ func skipQuoted(text string, pos int, quote byte) (int, bool) {
381
+ for i := pos + 1; i < len(text); i++ {
382
+ switch text[i] {
383
+ case '\\':
384
+ i++
385
+ case quote:
386
+ return i, true
387
+ case '\n', '\r':
388
+ return 0, false
389
+ }
390
+ }
391
+ return 0, false
392
+ }
393
+
394
+ func skipTemplate(text string, pos int) (int, bool) {
395
+ for i := pos + 1; i < len(text); i++ {
396
+ switch text[i] {
397
+ case '\\':
398
+ i++
399
+ case '`':
400
+ return i, true
401
+ }
402
+ }
403
+ return 0, false
404
+ }
405
+
406
+ func skipLineComment(text string, pos int) int {
407
+ for i := pos; i < len(text); i++ {
408
+ if text[i] == '\n' || text[i] == '\r' {
409
+ return i
410
+ }
411
+ }
412
+ return len(text) - 1
413
+ }
414
+
415
+ func skipBlockComment(text string, pos int) (int, bool) {
416
+ for i := pos; i+1 < len(text); i++ {
417
+ if text[i] == '*' && text[i+1] == '/' {
418
+ return i + 1, true
419
+ }
420
+ }
421
+ return 0, false
422
+ }
423
+
424
+ func canStartRegexLiteral(previous byte) bool {
425
+ return strings.ContainsRune("([{=,:;!&|?+-*~^<>%", rune(previous))
426
+ }
427
+
428
+ func skipRegexLiteral(text string, pos int) (int, bool) {
429
+ inClass := false
430
+ for i := pos + 1; i < len(text); i++ {
431
+ switch text[i] {
432
+ case '\\':
433
+ i++
434
+ case '[':
435
+ inClass = true
436
+ case ']':
437
+ inClass = false
438
+ case '/':
439
+ if inClass {
440
+ continue
441
+ }
442
+ for i+1 < len(text) && isRegexFlag(text[i+1]) {
443
+ i++
336
444
  }
337
- i = j
445
+ return i, true
446
+ case '\n', '\r':
447
+ return 0, false
338
448
  }
339
449
  }
340
450
  return 0, false
341
451
  }
452
+
453
+ func isRegexFlag(ch byte) bool {
454
+ return ch == '_' ||
455
+ ch == '$' ||
456
+ unicode.IsLetter(rune(ch)) ||
457
+ unicode.IsDigit(rune(ch))
458
+ }
@@ -0,0 +1,52 @@
1
+ package driver
2
+
3
+ import "testing"
4
+
5
+ func TestSpliceCallConsumesRegexLiteralWithClosingParen(t *testing.T) {
6
+ got := spliceForTest(t, `const out = plugin.make(/\)/, "ok");`)
7
+ want := `const out = replacement;`
8
+ if got != want {
9
+ t.Fatalf("unexpected rewrite:\nwant: %s\n got: %s", want, got)
10
+ }
11
+ }
12
+
13
+ func TestSpliceCallIgnoresClosingParenInsideBlockComment(t *testing.T) {
14
+ got := spliceForTest(t, `const out = plugin.make(1 /* ) */, 2);`)
15
+ want := `const out = replacement;`
16
+ if got != want {
17
+ t.Fatalf("unexpected rewrite:\nwant: %s\n got: %s", want, got)
18
+ }
19
+ }
20
+
21
+ func TestSpliceCallIgnoresClosingParenInsideLineComment(t *testing.T) {
22
+ got := spliceForTest(t, "const out = plugin.make(\n 1, // )\n 2\n);")
23
+ want := `const out = replacement;`
24
+ if got != want {
25
+ t.Fatalf("unexpected rewrite:\nwant: %s\n got: %s", want, got)
26
+ }
27
+ }
28
+
29
+ func TestSpliceCallKeepsDivisionOutsideRegexMode(t *testing.T) {
30
+ got := spliceForTest(t, `const out = plugin.make(total / divisor, 2);`)
31
+ want := `const out = replacement;`
32
+ if got != want {
33
+ t.Fatalf("unexpected rewrite:\nwant: %s\n got: %s", want, got)
34
+ }
35
+ }
36
+
37
+ func spliceForTest(t *testing.T, text string) string {
38
+ t.Helper()
39
+ got, _, ok, err := spliceCall(text, Rewrite{
40
+ RootName: "plugin",
41
+ Method: "make",
42
+ Replacement: "replacement",
43
+ ConsumeParens: true,
44
+ }, 0)
45
+ if err != nil {
46
+ t.Fatal(err)
47
+ }
48
+ if !ok {
49
+ t.Fatal("rewrite did not match")
50
+ }
51
+ return got
52
+ }
@@ -1,41 +1,11 @@
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
35
5
  Object.defineProperty(exports, "__esModule", { value: true });
36
6
  exports.TtscCompiler = void 0;
37
- const fs = __importStar(require("node:fs"));
38
- const path = __importStar(require("node:path"));
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
39
9
  const compileProjectInMemory_1 = require("./compiler/internal/compileProjectInMemory");
40
10
  const resolveProjectConfig_1 = require("./compiler/internal/project/resolveProjectConfig");
41
11
  const resolveBinary_1 = require("./compiler/internal/resolveBinary");
@@ -93,6 +63,7 @@ class TtscCompiler {
93
63
  cacheDir: this.resolvePluginCacheDir(),
94
64
  cwd: execution.cwd,
95
65
  entries: this.context.plugins,
66
+ projectRoot: execution.projectRoot,
96
67
  tsconfig: execution.tsconfig,
97
68
  });
98
69
  return loaded.nativePlugins.map((plugin) => plugin.binary);
@@ -118,9 +89,9 @@ class TtscCompiler {
118
89
  const envCacheDir = this.context.env?.TTSC_CACHE_DIR ?? process.env.TTSC_CACHE_DIR;
119
90
  const projectRoot = this.resolveCleanProjectRoot();
120
91
  return removeExistingDirectories([
121
- ...(envCacheDir ? [path.resolve(envCacheDir, "plugins")] : []),
122
- path.join(projectRoot, "node_modules", ".ttsc"),
123
- path.join(projectRoot, ".ttsc"),
92
+ ...(envCacheDir ? [node_path_1.default.resolve(envCacheDir, "plugins")] : []),
93
+ node_path_1.default.join(projectRoot, "node_modules", ".ttsc"),
94
+ node_path_1.default.join(projectRoot, ".ttsc"),
124
95
  ]);
125
96
  }
126
97
  /**
@@ -175,7 +146,9 @@ class TtscCompiler {
175
146
  });
176
147
  return {
177
148
  cwd,
178
- projectRoot: path.dirname(tsconfig),
149
+ projectRoot: this.context.projectRoot
150
+ ? node_path_1.default.resolve(cwd, this.context.projectRoot)
151
+ : node_path_1.default.dirname(tsconfig),
179
152
  tsconfig,
180
153
  };
181
154
  }
@@ -191,15 +164,15 @@ class TtscCompiler {
191
164
  }
192
165
  }
193
166
  resolveCwd() {
194
- return path.resolve(this.context.cwd ?? process.cwd());
167
+ return node_path_1.default.resolve(this.context.cwd ?? process.cwd());
195
168
  }
196
169
  resolveCacheDir() {
197
170
  if (!this.context.cacheDir) {
198
171
  return undefined;
199
172
  }
200
- return path.isAbsolute(this.context.cacheDir)
173
+ return node_path_1.default.isAbsolute(this.context.cacheDir)
201
174
  ? this.context.cacheDir
202
- : path.resolve(this.resolveCwd(), this.context.cacheDir);
175
+ : node_path_1.default.resolve(this.resolveCwd(), this.context.cacheDir);
203
176
  }
204
177
  resolvePluginCacheDir() {
205
178
  return this.resolveCacheDir() ?? this.context.env?.TTSC_CACHE_DIR;
@@ -209,10 +182,10 @@ exports.TtscCompiler = TtscCompiler;
209
182
  function removeExistingDirectories(directories) {
210
183
  const removed = [];
211
184
  for (const directory of [...new Set(directories)]) {
212
- if (!fs.existsSync(directory)) {
185
+ if (!node_fs_1.default.existsSync(directory)) {
213
186
  continue;
214
187
  }
215
- fs.rmSync(directory, { recursive: true, force: true });
188
+ node_fs_1.default.rmSync(directory, { recursive: true, force: true });
216
189
  removed.push(directory);
217
190
  }
218
191
  return removed;
@@ -241,8 +214,11 @@ function runTransformation(task) {
241
214
  }
242
215
  function toCompilerResult(project) {
243
216
  const { output, result } = project;
244
- if (result.status === 0 && result.diagnostics.length === 0) {
217
+ if (result.status === 0 && !hasErrorDiagnostics(result.diagnostics)) {
245
218
  return {
219
+ ...(result.diagnostics.length === 0
220
+ ? {}
221
+ : { diagnostics: result.diagnostics }),
246
222
  output,
247
223
  type: "success",
248
224
  };
@@ -267,8 +243,11 @@ function createProcessDiagnostic(result) {
267
243
  }
268
244
  function toCompilerTransformation(project) {
269
245
  const { result, typescript } = project;
270
- if (result.status === 0 && result.diagnostics.length === 0) {
246
+ if (result.status === 0 && !hasErrorDiagnostics(result.diagnostics)) {
271
247
  return {
248
+ ...(result.diagnostics.length === 0
249
+ ? {}
250
+ : { diagnostics: result.diagnostics }),
272
251
  type: "success",
273
252
  typescript,
274
253
  };
@@ -281,6 +260,9 @@ function toCompilerTransformation(project) {
281
260
  typescript,
282
261
  };
283
262
  }
263
+ function hasErrorDiagnostics(diagnostics) {
264
+ return diagnostics.some((diagnostic) => diagnostic.category === "error");
265
+ }
284
266
  function normalizeError(error) {
285
267
  if (!(error instanceof Error)) {
286
268
  return error;
@@ -1 +1 @@
1
- {"version":3,"file":"TtscCompiler.js","sourceRoot":"","sources":["../src/TtscCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,EAAE,oCAAgB;AAC9B,MAAY,IAAI,sCAAkB;AAElC,uFAAoF;AACpF,2FAAwF;AACxF,qEAAkE;AAClE,2FAAwF;AACxF,6EAA0E;AAO1E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IACmB,OAAO,CAAuB;IAE/C,Y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