Skip to content

Commit 8818be2

Browse files
committed
Merge branch 'upgrade-ts-to-4.4'
2 parents 968cc8f + 32512b6 commit 8818be2

File tree

82 files changed

+34316
-1049
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+34316
-1049
lines changed

TypeScript

Submodule TypeScript updated 4705 files

build/build.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import ts from "typescript";
44
import { replacement } from "./replacement";
55

66
const projectDir = process.env.PROJECT || process.cwd();
7-
const distDir = path.join(projectDir, "dist", "lib");
7+
const distDir = path.join(projectDir, "generated");
88
const tsDir = path.join(projectDir, "TypeScript");
99

1010
async function main() {
@@ -45,6 +45,10 @@ async function main() {
4545
const res = checkStatement(statement, repl);
4646
if (res) {
4747
result += res.getFullText(file);
48+
} else {
49+
// Replaced statements are emitted as comments
50+
// to make it easier to detect original lib changes
51+
result += "\n" + commentOut(statement.getFullText(file)) + "\n";
4852
}
4953
}
5054
}
@@ -92,6 +96,12 @@ function checkStatement(
9296
return statement;
9397
}
9498

99+
function commentOut(code: string): string {
100+
const lines = code.split("\n");
101+
const result = lines.map((line) => `// ${line}`);
102+
return result.join("\n");
103+
}
104+
95105
main().catch((err) => {
96106
console.error(err);
97107
process.exit(1);

build/package.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { mkdir, readdir, readFile, rm, writeFile } from "fs/promises";
22
import path from "path";
33

44
const projectDir = process.env.PROJECT || process.cwd();
5-
const libDir = path.join(projectDir, "dist", "lib");
5+
const libDir = path.join(projectDir, "generated");
66
const betterDir = path.join(projectDir, "lib");
77
const templateDir = path.join(projectDir, "package-template");
88
const packageDir = path.join(projectDir, "dist-package");

build/replacement.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ export const replacement = new Map([
4545
["es2018.asyncgenerator.d.ts", new Set(["AsyncGenerator"])],
4646
["es2018.asynciterable.d.ts", new Set(["AsyncIterator"])],
4747
["es2019.object.d.ts", new Set(["ObjectConstructor"])],
48-
["esnext.promise.d.ts", new Set(["AggregateError"])],
49-
["esnext.string.d.ts", new Set(["String"])],
48+
["es2021.promise.d.ts", new Set(["AggregateError"])],
49+
["es2021.string.d.ts", new Set(["String"])],
5050
]);

generated/better

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/Users/JP25309/personal/better-typescript-lib/lib

0 commit comments

Comments
 (0)