Skip to content

Commit d2352b2

Browse files
committed
Try running esbuild on tsc output
1 parent c86b59c commit d2352b2

File tree

5 files changed

+20
-16
lines changed

5 files changed

+20
-16
lines changed

Gulpfile.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,15 @@ async function esbuild(entrypoint, outfile) {
109109
]);
110110
}
111111

112-
const preBundle = parallel(generateLibs, series(buildScripts, generateDiagnostics, localize));
112+
const buildSrc = () => buildProject("src");
113+
114+
const preBundle = parallel(generateLibs, series(buildScripts, generateDiagnostics, localize, buildSrc));
113115

114-
const bundleTsc = () => esbuild("./src/tsc/tsc.ts", "./built/local/tsc.js");
115-
const bundleTypescript = () => esbuild("./src/typescript/typescript.ts", "./built/local/typescript.js");
116-
const bundleServer = () => esbuild("./src/tsserver/server.ts", "./built/local/tsserver.js");
117-
const bundleServerLibrary = () => esbuild("./src/tsserverlibrary/tsserverlibrary.ts", "./built/local/tsserverlibrary.js");
118-
const bundleTests = () => esbuild("./src/testRunner/_namespaces/Harness.ts", testRunner);
116+
const bundleTsc = () => esbuild("./built/local/tsc/tsc.js", "./built/local/tsc.js");
117+
const bundleTypescript = () => esbuild("./built/local/typescript/typescript.js", "./built/local/typescript.js");
118+
const bundleServer = () => esbuild("./built/local/tsserver/server.js", "./built/local/tsserver.js");
119+
const bundleServerLibrary = () => esbuild("./built/local/tsserverlibrary/tsserverlibrary.js", "./built/local/tsserverlibrary.js");
120+
const bundleTests = () => esbuild("./built/local/testRunner/_namespaces/Harness.js", testRunner);
119121

120122

121123
const bundleAll = series([
@@ -128,8 +130,7 @@ const bundleAll = series([
128130
task("bundle", series(preBundle, bundleAll));
129131

130132

131-
const buildSrc = () => buildProject("src");
132-
task("buildSrc", series(preBundle, bundleAll, buildSrc));
133+
task("buildSrc", series(preBundle));
133134

134135
const apiExtractor = async () => {
135136
async function runApiExtractor(configPath) {

src/compiler/sys.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,10 @@ export let sys: System = (() => {
15741574
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv as string[], arg => /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg)),
15751575
tryEnableSourceMapsForHost() {
15761576
try {
1577-
require("source-map-support").install();
1577+
// Trick esbuild into not eagerly resolving a path to a JS file.
1578+
// See: https://github.com/evanw/esbuild/issues/1958
1579+
const moduleName = "source-map-support" as const;
1580+
(require(moduleName) as typeof import("source-map-support")).install();
15781581
}
15791582
catch {
15801583
// Could not enable source maps.

src/server/scriptVersionCache.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,16 +255,16 @@ class TextChange {
255255

256256
/** @internal */
257257
export class ScriptVersionCache {
258+
private static readonly changeNumberThreshold = 8;
259+
private static readonly changeLengthThreshold = 256;
260+
private static readonly maxVersions = 8;
261+
258262
private changes: TextChange[] = [];
259263
private readonly versions: LineIndexSnapshot[] = new Array<LineIndexSnapshot>(ScriptVersionCache.maxVersions);
260264
private minVersion = 0; // no versions earlier than min version will maintain change history
261265

262266
private currentVersion = 0;
263267

264-
private static readonly changeNumberThreshold = 8;
265-
private static readonly changeLengthThreshold = 256;
266-
private static readonly maxVersions = 8;
267-
268268
private versionToIndex(version: number) {
269269
if (version < this.minVersion || version > this.currentVersion) {
270270
return undefined;

src/services/services.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,9 @@ class IdentifierObject extends TokenOrIdentifierObject implements Identifier {
484484
}
485485
IdentifierObject.prototype.kind = SyntaxKind.Identifier;
486486
class PrivateIdentifierObject extends TokenOrIdentifierObject implements PrivateIdentifier {
487-
public kind!: SyntaxKind.PrivateIdentifier;
487+
public kind: SyntaxKind.PrivateIdentifier = SyntaxKind.PrivateIdentifier;
488488
public escapedText!: __String;
489-
public symbol!: Symbol;
489+
// public symbol!: Symbol;
490490
_primaryExpressionBrand: any;
491491
_memberExpressionBrand: any;
492492
_leftHandSideExpressionBrand: any;

src/tsconfig-base.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"sourceMap": true,
1111
"composite": true,
1212
"noEmitOnError": true,
13-
"emitDeclarationOnly": true,
13+
// "emitDeclarationOnly": true,
1414

1515
"strictNullChecks": true,
1616
"noImplicitAny": true,

0 commit comments

Comments
 (0)