Skip to content

Commit b2807ab

Browse files
committed
Eliminate exportAsModule.ts
1 parent 6382230 commit b2807ab

File tree

6 files changed

+22
-32
lines changed

6 files changed

+22
-32
lines changed

Diff for: Gulpfile.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,10 @@ function esbuildTask(entrypoint, outfile) {
180180
"object-rest-spread": false, // See: https://github.com/evanw/esbuild/releases/tag/v0.14.46
181181
},
182182
// legalComments: "none", // TODO(jakebailey): enable once we add copyright headers to our source files.
183-
logLevel: "info",
183+
// logLevel: "info",
184184
};
185185

186+
// TODO: these need to have better function names, for gulp.
186187
return {
187188
build: () => esbuild.build(options),
188189
clean: () => del([outfile, `${outfile}.map`]),

Diff for: src/services/_namespaces/ts.ts

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export * from "../services";
1818
export * from "../transform";
1919
export * from "../shims";
2020
export * from "../globalThisShim";
21-
export * from "../exportAsModule";
2221
import * as BreakpointResolver from "./ts.BreakpointResolver";
2322
export { BreakpointResolver };
2423
import * as CallHierarchy from "./ts.CallHierarchy";

Diff for: src/services/exportAsModule.ts

-21
This file was deleted.

Diff for: src/services/tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@
134134
"transform.ts",
135135
"shims.ts",
136136
"globalThisShim.ts",
137-
"exportAsModule.ts",
138137
"_namespaces/ts.BreakpointResolver.ts",
139138
"_namespaces/ts.ts",
140139
"_namespaces/ts.CallHierarchy.ts",

Diff for: src/tsserverlibrary/tsserverlibrary.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
export * from "./_namespaces/ts";
1+
import ts = require("./_namespaces/ts");
2+
3+
// esbuild compatible way of conditionally exporting; for non-node compatibility.
4+
5+
/** @internal */ declare const module: { exports: {} };
6+
if (typeof module !== "undefined" && module.exports) {
7+
module.exports = ts;
8+
}

Diff for: src/typescript/typescript.ts

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1-
import { Debug, LogLevel } from "./_namespaces/ts";
1+
import ts = require("./_namespaces/ts");
22

33
// enable deprecation logging
44
declare const console: any;
55
if (typeof console !== "undefined") {
6-
Debug.loggingHost = {
6+
ts.Debug.loggingHost = {
77
log(level, s) {
88
switch (level) {
9-
case LogLevel.Error: return console.error(s);
10-
case LogLevel.Warning: return console.warn(s);
11-
case LogLevel.Info: return console.log(s);
12-
case LogLevel.Verbose: return console.log(s);
9+
case ts.LogLevel.Error: return console.error(s);
10+
case ts.LogLevel.Warning: return console.warn(s);
11+
case ts.LogLevel.Info: return console.log(s);
12+
case ts.LogLevel.Verbose: return console.log(s);
1313
}
1414
}
1515
};
1616
}
1717

18-
export * from "./_namespaces/ts";
18+
// esbuild compatible way of conditionally exporting; for non-node compatibility.
19+
20+
/** @internal */ declare const module: { exports: {} };
21+
if (typeof module !== "undefined" && module.exports) {
22+
module.exports = ts;
23+
}

0 commit comments

Comments
 (0)