ttsc 0.8.1 → 0.10.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 +109 -115
- package/cmd/ttsc/api_transform.go +54 -51
- package/cmd/ttsc/main.go +103 -121
- package/driver/program.go +30 -2
- package/driver/rewrite.go +126 -9
- package/go.mod +2 -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 +287 -139
- 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/shim/printer/go.mod +5 -0
- package/shim/printer/shim.go +23 -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 +321 -50
- 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 +622 -20
- package/cmd/ttsc/main_test.go +0 -288
- 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
package/test/tsgo.test.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
const assert = require("node:assert/strict");
|
|
2
|
-
const fs = require("node:fs");
|
|
3
|
-
const os = require("node:os");
|
|
4
|
-
const path = require("node:path");
|
|
5
|
-
const test = require("node:test");
|
|
6
|
-
const { resolveTsgo } = require("../lib/compiler/internal/resolveTsgo.js");
|
|
7
|
-
|
|
8
|
-
test("resolveTsgo accepts TTSC_TSGO_BINARY as an explicit compiler", () => {
|
|
9
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), "ttsc-tsgo-test-"));
|
|
10
|
-
const binary = path.join(root, "tsgo");
|
|
11
|
-
fs.writeFileSync(binary, "", "utf8");
|
|
12
|
-
|
|
13
|
-
const resolved = resolveTsgo({
|
|
14
|
-
env: { TTSC_TSGO_BINARY: binary },
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
assert.equal(resolved.binary, binary);
|
|
18
|
-
assert.equal(resolved.version, "custom");
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test("resolveTsgo resolves the consumer native-preview platform package", () => {
|
|
22
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), "ttsc-tsgo-test-"));
|
|
23
|
-
const nativeRoot = path.join(
|
|
24
|
-
root,
|
|
25
|
-
"node_modules",
|
|
26
|
-
"@typescript",
|
|
27
|
-
"native-preview",
|
|
28
|
-
);
|
|
29
|
-
const platformRoot = path.join(
|
|
30
|
-
root,
|
|
31
|
-
"node_modules",
|
|
32
|
-
"@typescript",
|
|
33
|
-
`native-preview-${process.platform}-${process.arch}`,
|
|
34
|
-
);
|
|
35
|
-
fs.mkdirSync(nativeRoot, { recursive: true });
|
|
36
|
-
fs.mkdirSync(path.join(platformRoot, "lib"), { recursive: true });
|
|
37
|
-
fs.writeFileSync(
|
|
38
|
-
path.join(nativeRoot, "package.json"),
|
|
39
|
-
JSON.stringify({
|
|
40
|
-
name: "@typescript/native-preview",
|
|
41
|
-
version: "7.0.0-dev.consumer",
|
|
42
|
-
gitHead: "abc123",
|
|
43
|
-
}),
|
|
44
|
-
"utf8",
|
|
45
|
-
);
|
|
46
|
-
fs.writeFileSync(
|
|
47
|
-
path.join(platformRoot, "package.json"),
|
|
48
|
-
JSON.stringify({
|
|
49
|
-
name: `@typescript/native-preview-${process.platform}-${process.arch}`,
|
|
50
|
-
version: "7.0.0-dev.consumer",
|
|
51
|
-
}),
|
|
52
|
-
"utf8",
|
|
53
|
-
);
|
|
54
|
-
const binary = path.join(
|
|
55
|
-
platformRoot,
|
|
56
|
-
"lib",
|
|
57
|
-
process.platform === "win32" ? "tsgo.exe" : "tsgo",
|
|
58
|
-
);
|
|
59
|
-
fs.writeFileSync(binary, "", "utf8");
|
|
60
|
-
|
|
61
|
-
const resolved = resolveTsgo({
|
|
62
|
-
cwd: root,
|
|
63
|
-
env: {},
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
assert.equal(resolved.version, "7.0.0-dev.consumer");
|
|
67
|
-
assert.equal(resolved.gitHead, "abc123");
|
|
68
|
-
assert.equal(resolved.binary, binary);
|
|
69
|
-
});
|