Skip to content

Commit

Permalink
Rename typescriptServices, protocol.d.ts, typescript_standalone.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Oct 4, 2022
1 parent d06719f commit bc1fcec
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 270 deletions.
54 changes: 13 additions & 41 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,55 +119,31 @@ const localPreBuild = parallel(generateLibs, series(buildScripts, generateDiagno
const preBuild = cmdLineOptions.lkg ? lkgPreBuild : localPreBuild;

const buildServices = (() => {
// build typescriptServices.out.js
const buildTypescriptServicesOut = () => buildProject("src/typescriptServices/tsconfig.json", cmdLineOptions);

// create typescriptServices.js
const createTypescriptServicesJs = () => src("built/local/typescriptServices.out.js")
.pipe(newer("built/local/typescriptServices.js"))
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(prependFile(copyright))
.pipe(rename("typescriptServices.js"))
.pipe(sourcemaps.write(".", { includeContent: false, destPath: "built/local" }))
.pipe(dest("built/local"));

// create typescriptServices.d.ts
const createTypescriptServicesDts = () => src("built/local/typescriptServices.out.d.ts")
.pipe(newer("built/local/typescriptServices.d.ts"))
.pipe(prependFile(copyright))
.pipe(transform(content => content.replace(/^(\s*)(export )?const enum (\S+) {(\s*)$/gm, "$1$2enum $3 {$4")))
.pipe(rename("typescriptServices.d.ts"))
.pipe(dest("built/local"));
// build typescript.out.js
const buildTypescriptOut = () => buildProject("src/typescript/tsconfig.json", cmdLineOptions);

// create typescript.js
const createTypescriptJs = () => src("built/local/typescriptServices.js")
const createTypescriptJs = () => src("built/local/typescript.out.js")
.pipe(newer("built/local/typescript.js"))
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(prependFile(copyright))
.pipe(rename("typescript.js"))
.pipe(sourcemaps.write(".", { includeContent: false, destPath: "built/local" }))
.pipe(dest("built/local"));

// create typescript.d.ts
const createTypescriptDts = () => src("built/local/typescriptServices.d.ts")
const createTypescriptDts = () => src("built/local/typescript.out.d.ts")
.pipe(newer("built/local/typescript.d.ts"))
.pipe(prependFile(copyright))
.pipe(transform(content => content.replace(/^(\s*)(export )?const enum (\S+) {(\s*)$/gm, "$1$2enum $3 {$4")))
.pipe(append("\nexport = ts;"))
.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"));

return series(
buildTypescriptServicesOut,
createTypescriptServicesJs,
createTypescriptServicesDts,
buildTypescriptOut,
createTypescriptJs,
createTypescriptDts,
createTypescriptStandaloneDts,
);
})();
task("services", series(preBuild, buildServices));
Expand All @@ -177,17 +153,15 @@ task("services").flags = {
};

const cleanServices = async () => {
if (fs.existsSync("built/local/typescriptServices.tsconfig.json")) {
await cleanProject("built/local/typescriptServices.tsconfig.json");
if (fs.existsSync("built/local/typescript.tsconfig.json")) {
await cleanProject("built/local/typescript.tsconfig.json");
}
await del([
"built/local/typescriptServices.out.js",
"built/local/typescriptServices.out.d.ts",
"built/local/typescriptServices.out.tsbuildinfo",
"built/local/typescriptServices.js",
"built/local/typescript.out.js",
"built/local/typescript.out.d.ts",
"built/local/typescript.out.tsbuildinfo",
"built/local/typescript.js",
"built/local/typescript.d.ts",
"built/local/typescript_standalone.d.ts"
]);
};
cleanTasks.push(cleanServices);
Expand Down Expand Up @@ -511,8 +485,6 @@ const cleanBuilt = () => del("built");
const produceLKG = async () => {
const expectedFiles = [
"built/local/tsc.release.js",
"built/local/typescriptServices.js",
"built/local/typescriptServices.d.ts",
"built/local/tsserver.js",
"built/local/dynamicImportCompat.js",
"built/local/typescript.js",
Expand Down
2 changes: 1 addition & 1 deletion scripts/VSDevMode.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if(!(Test-Path $tsRegKey)){
}

if($tsScript -ne ""){
$tsScriptServices = "${tsScript}\typescriptServices.js"
$tsScriptServices = "${tsScript}\typescript.js"
$tsScriptlib = "${tsScript}\lib.d.ts"
$tsES6Scriptlib = "${tsScript}\lib.es6.d.ts"

Expand Down
200 changes: 0 additions & 200 deletions scripts/buildProtocol.ts

This file was deleted.

13 changes: 4 additions & 9 deletions scripts/createPlaygroundBuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// This script does two things:
//
// - Listens to changes to the built version of TypeScript (via a filewatcher on `built/local/typescriptServices.js`)
// - Listens to changes to the built version of TypeScript (via a filewatcher on `built/local/typescript.js`)
// these trigger creating monaco-typescript compatible builds of TypeScript at `internal/lib/typescriptServices.js§
//
// - Creates a HTTP server which the playground uses. The webserver almost exclusively re-directs requests to
Expand Down Expand Up @@ -60,7 +60,7 @@ function updateTSDist() {
);

let tsServices = fs
.readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescriptServices.js'))
.readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescript.js'))
.toString();

// Ensure we never run into the node system...
Expand Down Expand Up @@ -155,13 +155,8 @@ function updateTSDist() {
);

let dtsServices = fs
.readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescriptServices.d.ts'))
.readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescript.d.ts'))
.toString();
dtsServices += `
// MONACOCHANGE
export = ts;
// END MONACOCHANGE
`;
fs.writeFileSync(
path.join(TYPESCRIPT_LIB_DESTINATION, 'typescriptServices.d.ts'),
generatedNote + dtsServices
Expand Down Expand Up @@ -271,7 +266,7 @@ function updateTSDist() {
/// End of import
}

const services = path.join(__dirname, '../built/local/typescriptServices.js');
const services = path.join(__dirname, '../built/local/typescript.js');
fs.watchFile(services, () =>{
console.log("Updating the monaco build")
updateTSDist()
Expand Down
Loading

0 comments on commit bc1fcec

Please sign in to comment.