ttsc 0.8.1 → 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.
- package/README.md +39 -68
- package/cmd/ttsc/api_compile.go +5 -1
- package/driver/program.go +23 -1
- package/driver/rewrite.go +126 -9
- package/driver/rewrite_test.go +52 -0
- package/lib/TtscCompiler.js +28 -46
- package/lib/TtscCompiler.js.map +1 -1
- package/lib/compiler/internal/buildNativeCompiler.js +8 -38
- package/lib/compiler/internal/buildNativeCompiler.js.map +1 -1
- package/lib/compiler/internal/compileProjectInMemory.js +36 -63
- package/lib/compiler/internal/compileProjectInMemory.js.map +1 -1
- package/lib/compiler/internal/project/readProjectConfig.js +108 -60
- package/lib/compiler/internal/project/readProjectConfig.js.map +1 -1
- package/lib/compiler/internal/project/resolveProjectConfig.js +15 -45
- package/lib/compiler/internal/project/resolveProjectConfig.js.map +1 -1
- package/lib/compiler/internal/resolveBinary.js +10 -40
- package/lib/compiler/internal/resolveBinary.js.map +1 -1
- package/lib/compiler/internal/resolveEmittedJavaScript.js +21 -48
- package/lib/compiler/internal/resolveEmittedJavaScript.js.map +1 -1
- package/lib/compiler/internal/resolveTsgo.js +14 -44
- package/lib/compiler/internal/resolveTsgo.js.map +1 -1
- package/lib/compiler/internal/runBuild.d.ts +7 -0
- package/lib/compiler/internal/runBuild.js +47 -66
- package/lib/compiler/internal/runBuild.js.map +1 -1
- package/lib/compiler/internal/runSingleFileEmit.js +18 -48
- package/lib/compiler/internal/runSingleFileEmit.js.map +1 -1
- package/lib/compiler/internal/transformProjectInMemory.js +41 -75
- package/lib/compiler/internal/transformProjectInMemory.js.map +1 -1
- package/lib/launcher/internal/getCompilerVersionText.js +7 -37
- package/lib/launcher/internal/getCompilerVersionText.js.map +1 -1
- package/lib/launcher/internal/prepareExecution.js +48 -69
- package/lib/launcher/internal/prepareExecution.js.map +1 -1
- package/lib/launcher/internal/runTtsc.js +53 -64
- package/lib/launcher/internal/runTtsc.js.map +1 -1
- package/lib/launcher/internal/runTtsx.js +328 -57
- package/lib/launcher/internal/runTtsx.js.map +1 -1
- package/lib/plugin/internal/buildSourcePlugin.d.ts +8 -0
- package/lib/plugin/internal/buildSourcePlugin.js +179 -125
- package/lib/plugin/internal/buildSourcePlugin.js.map +1 -1
- package/lib/plugin/internal/loadProjectPlugins.d.ts +2 -0
- package/lib/plugin/internal/loadProjectPlugins.js +197 -9
- package/lib/plugin/internal/loadProjectPlugins.js.map +1 -1
- package/lib/structures/ITtscCompilerContext.d.ts +16 -3
- package/lib/structures/ITtscCompilerResult.d.ts +4 -0
- package/lib/structures/ITtscCompilerTransformation.d.ts +2 -0
- package/lib/structures/ITtscPluginFactoryContext.d.ts +6 -3
- package/lib/structures/ITtscProjectPluginConfig.d.ts +8 -7
- package/lib/structures/internal/ITtscParsedProjectConfig.d.ts +2 -0
- package/lib/structures/internal/ITtscProjectLocatorOptions.d.ts +2 -0
- package/lib/structures/internal/TtscCommonOptions.d.ts +2 -0
- package/package.json +9 -14
- package/shim/diagnosticwriter/lint.go +8 -0
- package/src/TtscCompiler.ts +20 -5
- package/src/compiler/internal/buildNativeCompiler.ts +2 -2
- package/src/compiler/internal/compileProjectInMemory.ts +21 -16
- package/src/compiler/internal/project/readProjectConfig.ts +134 -35
- package/src/compiler/internal/project/resolveProjectConfig.ts +2 -2
- package/src/compiler/internal/resolveBinary.ts +2 -2
- package/src/compiler/internal/resolveEmittedJavaScript.ts +11 -7
- package/src/compiler/internal/resolveTsgo.ts +2 -2
- package/src/compiler/internal/runBuild.ts +34 -21
- package/src/compiler/internal/runSingleFileEmit.ts +3 -3
- package/src/compiler/internal/transformProjectInMemory.ts +37 -37
- package/src/launcher/internal/getCompilerVersionText.ts +2 -2
- package/src/launcher/internal/prepareExecution.ts +14 -4
- package/src/launcher/internal/runTtsc.ts +30 -4
- package/src/launcher/internal/runTtsx.ts +377 -26
- package/src/plugin/internal/buildSourcePlugin.ts +127 -32
- package/src/plugin/internal/loadProjectPlugins.ts +266 -10
- package/src/structures/ITtscCompilerContext.ts +17 -3
- package/src/structures/ITtscCompilerResult.ts +5 -0
- package/src/structures/ITtscCompilerTransformation.ts +3 -0
- package/src/structures/ITtscPluginFactoryContext.ts +6 -3
- package/src/structures/ITtscProjectPluginConfig.ts +8 -7
- package/src/structures/internal/ITtscParsedProjectConfig.ts +2 -0
- package/src/structures/internal/ITtscProjectLocatorOptions.ts +2 -0
- package/src/structures/internal/TtscCommonOptions.ts +2 -0
- package/utility/host.go +610 -18
- package/utility/host_test.go +162 -0
- package/test/compiler.test.ts +0 -422
- package/test/platform.test.ts +0 -12
- package/test/project.test.ts +0 -197
- package/test/source-build.test.ts +0 -45
- package/test/tsgo.test.ts +0 -69
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Raw `compilerOptions.plugins[]`
|
|
2
|
+
* Raw plugin entry read from `compilerOptions.plugins[]` or from a directly
|
|
3
|
+
* installed package's `package.json#ttsc.plugin` marker.
|
|
3
4
|
*
|
|
4
|
-
* This is the project-facing config shape that users write in
|
|
5
|
-
* `
|
|
6
|
-
* packages own their own config fields.
|
|
5
|
+
* This is the project-facing config shape that users write in `tsconfig.json`
|
|
6
|
+
* or plugin packages expose through `package.json`. ttsc deliberately keeps it
|
|
7
|
+
* open-ended because plugin packages own their own config fields.
|
|
7
8
|
*
|
|
8
9
|
* ttsc interprets only two properties:
|
|
9
10
|
*
|
|
@@ -28,9 +29,9 @@ export interface ITtscProjectPluginConfig {
|
|
|
28
29
|
/**
|
|
29
30
|
* Plugin module specifier, relative path, or absolute path to load.
|
|
30
31
|
*
|
|
31
|
-
* Relative paths are resolved from the
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* Relative paths are resolved from the tsconfig/jsconfig file that declared
|
|
33
|
+
* the plugin entry. Package specifiers are resolved with Node's package
|
|
34
|
+
* resolution from that same directory.
|
|
34
35
|
*
|
|
35
36
|
* The loaded JavaScript module must export an {@link ITtscPlugin} descriptor
|
|
36
37
|
* or a `createTtscPlugin(context)` factory. The Go implementation itself is
|
|
@@ -11,6 +11,8 @@ export interface ITtscParsedProjectConfig {
|
|
|
11
11
|
} & Record<string, unknown>;
|
|
12
12
|
/** Absolute path to the resolved tsconfig/jsconfig. */
|
|
13
13
|
path: string;
|
|
14
|
+
/** Directory that declared each inherited plugin entry. */
|
|
15
|
+
pluginBaseDirs: string[];
|
|
14
16
|
/** Directory containing the resolved tsconfig/jsconfig. */
|
|
15
17
|
root: string;
|
|
16
18
|
}
|
|
@@ -4,6 +4,8 @@ export interface ITtscProjectLocatorOptions {
|
|
|
4
4
|
cwd?: string;
|
|
5
5
|
/** Source file used as the starting point for nearest-config discovery. */
|
|
6
6
|
file?: string;
|
|
7
|
+
/** Project root override for generated tsconfig wrappers. */
|
|
8
|
+
projectRoot?: string;
|
|
7
9
|
/** Explicit tsconfig/jsconfig path. */
|
|
8
10
|
tsconfig?: string;
|
|
9
11
|
}
|
|
@@ -11,6 +11,8 @@ export interface TtscCommonOptions {
|
|
|
11
11
|
binary?: string;
|
|
12
12
|
/** Working directory for config discovery and relative file paths. */
|
|
13
13
|
cwd?: string;
|
|
14
|
+
/** Project root override for generated tsconfig wrappers. */
|
|
15
|
+
projectRoot?: string;
|
|
14
16
|
/** Environment variables merged over `process.env` for child processes. */
|
|
15
17
|
env?: NodeJS.ProcessEnv;
|
|
16
18
|
/** Explicit root directory for compiled source-plugin cache artifacts. */
|