Skip to content

Commit

Permalink
Get entrypoints working
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Sep 13, 2022
1 parent 9d46c28 commit 223a3f5
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 12 deletions.
14 changes: 7 additions & 7 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,20 +166,20 @@ const buildServices = (() => {
.pipe(rename("typescript.d.ts"))
.pipe(dest("built/local"));

// create typescript_standalone.d.ts
const createTypescriptStandaloneDts = () => src("built/local/typescriptServices.d.ts")
.pipe(newer("built/local/typescript_standalone.d.ts"))
.pipe(transform(content => content.replace(/declare (namespace|module) ts/g, 'declare module "typescript"')))
.pipe(rename("typescript_standalone.d.ts"))
.pipe(dest("built/local"));
// // create typescript_standalone.d.ts
// const createTypescriptStandaloneDts = () => src("built/local/typescriptServices.d.ts")
// .pipe(newer("built/local/typescript_standalone.d.ts"))
// .pipe(transform(content => content.replace(/declare (namespace|module) ts/g, 'declare module "typescript"')))
// .pipe(rename("typescript_standalone.d.ts"))
// .pipe(dest("built/local"));

return series(
buildTypescriptServicesOut,
createTypescriptServicesJs,
createTypescriptServicesDts,
createTypescriptJs,
createTypescriptDts,
createTypescriptStandaloneDts,
// createTypescriptStandaloneDts,
);
})();
task("services", series(preBuild, buildServices));
Expand Down
1 change: 0 additions & 1 deletion src/tsc/_namespaces/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

export * from "../../compiler/_namespaces/ts";
export * from "../../executeCommandLine/_namespaces/ts";
export * from "../tsc";
5 changes: 4 additions & 1 deletion src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
"references": [
{ "path": "./tsc" },
{ "path": "./tsserver" },
{ "path": "./tsserverlibrary" },
{ "path": "./typescript" },
{ "path": "./typescriptServices" },
{ "path": "./typingsInstaller" },
{ "path": "./watchGuard" },
{ "path": "./debug" },
{ "path": "./cancellationToken" },
{ "path": "./dynamicImportCompat" },
{ "path": "./testRunner" }
{ "path": "./testRunner" },
]
}
3 changes: 2 additions & 1 deletion src/tsserver/nodeServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,8 @@ function startNodeSession(options: StartSessionOptions, logger: Logger, cancella
}
}

this.installer = childProcess.fork(combinePaths(__dirname, "typingsInstaller.js"), args, { execArgv });
// TODO(jakebailey): fix this for module transform
this.installer = childProcess.fork(combinePaths(__dirname, "..", "typingsInstaller", "nodeTypingsInstaller.js"), args, { execArgv });
this.installer.on("message", m => this.handleMessage(m));

// We have to schedule this event to the next tick
Expand Down
1 change: 0 additions & 1 deletion src/tsserverlibrary/_namespaces/ts.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

export * from "../../jsTyping/_namespaces/ts.server";
export * from "../../server/_namespaces/ts.server";
export * from "../tsserverlibrary";
6 changes: 5 additions & 1 deletion src/tsserverlibrary/tsserverlibrary.ts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
export { };
import * as ts from "./_namespaces/ts";

// TODO(jakebailey): replace const enum with enum in d.ts

export = ts;
6 changes: 6 additions & 0 deletions src/typescript/_namespaces/ts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* Generated file to emulate the ts namespace. */

export * from "../../compiler/_namespaces/ts";
export * from "../../jsTyping/_namespaces/ts";
export * from "../../services/_namespaces/ts";
export * from "../../deprecatedCompat/_namespaces/ts";
16 changes: 16 additions & 0 deletions src/typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../tsconfig-library-base",
"compilerOptions": {
"outDir": "../../built/local"
},
"files": [
"typescript.ts",
"_namespaces/ts.ts"
],
"references": [
{ "path": "../compiler" },
{ "path": "../jsTyping" },
{ "path": "../services" },
{ "path": "../deprecatedCompat" }
]
}
21 changes: 21 additions & 0 deletions src/typescript/typescript.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as ts from "./_namespaces/ts";
import { Debug, LogLevel } from "./_namespaces/ts";

// TODO(jakebailey): replace const enum with enum in d.ts

// enable deprecation logging
declare const console: any;
if (typeof console !== "undefined") {
Debug.loggingHost = {
log(level, s) {
switch (level) {
case LogLevel.Error: return console.error(s);
case LogLevel.Warning: return console.warn(s);
case LogLevel.Info: return console.log(s);
case LogLevel.Verbose: return console.log(s);
}
}
};
}

export = ts;
2 changes: 2 additions & 0 deletions src/typescriptServices/typescriptServices.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Debug, LogLevel } from "./_namespaces/ts";

// TODO(jakebailey): replace const enum with enum in d.ts

// enable deprecation logging
declare const console: any;
if (typeof console !== "undefined") {
Expand Down

0 comments on commit 223a3f5

Please sign in to comment.