Skip to content

Commit ac0f02b

Browse files
authored
Remove .d.ts post-process in deploy+migrate scripts (#2071)
It has not been needed for years but I never noticed because I forgot about these scripts and never used them. This means that the types packages used for overriding the default DOM types have had AbortSignal.abort incorrectly disabled all this time, but it's rarely used (only a few repos per million at Google, at least), so nobody ever complained about it.
1 parent 3a1f279 commit ac0f02b

File tree

2 files changed

+0
-34
lines changed

2 files changed

+0
-34
lines changed

deploy/createTypesPackages.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ const go = async () => {
134134
});
135135

136136
prependAutoImports(pkg, packagePath);
137-
postProcessDTSFiles(pkg, packagePath);
138137

139138
// Setup the files in the repo
140139
const newPkgJSON = await updatePackageJSON(pkg, packagePath);
@@ -266,30 +265,6 @@ function relativeUrl(from, to) {
266265
: `./${relative}`;
267266
}
268267

269-
/**
270-
* Handles any post-processing we do for deployment.
271-
* @param {Package} pkg
272-
* @param {URL} packagePath
273-
*/
274-
export function postProcessDTSFiles(pkg, packagePath) {
275-
iterateThroughFiles((content) => {
276-
return content.replace(
277-
"abort(reason?: any): AbortSignal;",
278-
"// abort(reason?: any): AbortSignal; - To be re-added in the future",
279-
);
280-
});
281-
282-
/** @param {(str:string) => string} contentReplacer */
283-
function iterateThroughFiles(contentReplacer) {
284-
pkg.files.forEach((fileRef) => {
285-
const dtsFileURL = new URL(fileRef.to, packagePath);
286-
let dtsContent = fs.readFileSync(dtsFileURL, "utf-8");
287-
dtsContent = contentReplacer(dtsContent);
288-
fs.writeFileSync(dtsFileURL, dtsContent);
289-
});
290-
}
291-
}
292-
293268
if (process.argv[1] === fileURLToPath(import.meta.url)) {
294269
await go();
295270
}

deploy/migrate.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import { existsSync, readdirSync, readFileSync, writeFileSync } from "fs";
88
import { join } from "path";
99

10-
import { postProcessDTSFiles } from "./createTypesPackages.js";
11-
1210
const maybeTSWorkingDir = [process.argv[2], "../TypeScript", "TypeScript"];
1311
const tscWD = maybeTSWorkingDir.find((wd) => existsSync(wd));
1412

@@ -22,13 +20,6 @@ const filesToSend = generatedFiles.filter(
2220
(file) => file.includes("dom.") || file.includes("webworker."),
2321
);
2422

25-
const generatedDir = new URL("../generated/", import.meta.url);
26-
postProcessDTSFiles(
27-
/** @type {any} */
28-
({ files: filesToSend.map((f) => ({ to: f })) }),
29-
generatedDir,
30-
);
31-
3223
filesToSend.forEach((file) => {
3324
const contents = readFileSync(join("generated", file), "utf8");
3425
const newFilePath = join(tscWD, "src", "lib", file);

0 commit comments

Comments
 (0)