Scribbles, nothing works yet

This commit is contained in:
Nathan Shively-Sanders
2021-07-30 09:11:54 -07:00
parent 9d957c64c5
commit b596c6148f
4 changed files with 21 additions and 0 deletions
+9
View File
@@ -438,6 +438,8 @@ namespace ts {
if (bundleBuildInfo) bundleBuildInfo.js = printer.bundleFileInfo;
}
const horrible: Record<string, readonly SourceFile[]> = {}
function emitDeclarationFileOrBundle(
sourceFileOrBundle: SourceFile | Bundle | undefined,
declarationFilePath: string | undefined,
@@ -449,6 +451,13 @@ namespace ts {
return;
}
const sourceFiles = isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles;
const key = sourceFiles.map(f => f.fileName).join("|")
console.log(key)
horrible[key] = sourceFiles
// Let's do this WRONG
// 1. cache with key=filesForEmit, value=[emit, diagnostics]
// 2. include custom transformers in the key, plus "other api things" (??)
// Afterward, need to measure performance to see which projects this helps/how much. Ask Andrew about this.
const filesForEmit = forceDtsEmit ? sourceFiles : filter(sourceFiles, isSourceFileNotJson);
// Setup and perform the transformation to retrieve declarations from the input files
const inputListOrBundle = outFile(compilerOptions) ? [factory.createBundle(filesForEmit, !isSourceFile(sourceFileOrBundle) ? sourceFileOrBundle.prepends : undefined)] : filesForEmit;
@@ -114,5 +114,12 @@ export function fn4() {
}),
commandLineArgs: ["--b", "/src/packages/pkg2/tsconfig.json", "--verbose"]
});
verifyTsc({
scenario: "doubleEmit",
subScenario: "cache declaration emit from build",
fs: () => loadProjectFromFiles({
}),
commandLineArgs: ["--b", "/src/packages/pkg2/tsconfig.json", "--verbose"]
});
});
}
@@ -8,6 +8,8 @@ namespace ts {
projFs = undefined!;
});
// This is pretty close but the example only has one project. Still it's worth debugging it to see.
// (for initial debugging, it's STILl probably easier to attach to ~/dmp/buildbasic/test though)
function verifyEmitDeclarationOnly(disableMap?: true) {
verifyTscSerializedIncrementalEdits({
subScenario: `only dts output in circular import project with emitDeclarationOnly${disableMap ? "" : " and declarationMap"}`,
@@ -201,6 +201,9 @@ namespace ts {
modifyFs: fs => replaceText(fs, sources[Project.third][Source.config], `"composite": true,`, ""),
});
it("only generates declaration emit once on subsequent edits and recompiles", () => {
})
it("rebuilds completely when version in tsbuildinfo doesnt match ts version", () => {
const { fs, tick } = getFsWithTime(outFileFs);
const host = fakes.SolutionBuilderHost.create(fs);