Explorar el Código

Updates to support the TS 3.6.0 beta, and adds a daily run-script (#36)

Updates to support the TS 3.6.0 beta, and adds a daily run-script
Alexandru Dima hace 5 años
padre
commit
c9f75d56c2

+ 25 - 0
azure-pipelines.yml

@@ -0,0 +1,25 @@
+# triggered by schedule at 5am to try make sure it's done after the TS daily build
+schedules:
+- cron: '0 5 * * *'
+  displayName: Daily 5am build
+  branches:
+    include:
+    - master
+  always: true
+
+pr: none
+
+pool:
+  vmImage: 'ubuntu-latest'
+
+steps:
+- bash: |
+    npm install
+    npm run run-nightly
+  displayName: 'Update & Build'
+
+- bash: |
+    echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
+    npm publish --tag next
+
+  displayName: 'Publish to NPM'

+ 3 - 3
package-lock.json

@@ -52,9 +52,9 @@
       "dev": true
       "dev": true
     },
     },
     "typescript": {
     "typescript": {
-      "version": "3.5.1",
-      "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.1.tgz",
-      "integrity": "sha512-64HkdiRv1yYZsSe4xC1WVgamNigVYjlssIoaH2HcZF0+ijsk5YK2g0G34w9wJkze8+5ow4STd22AynfO6ZYYLw==",
+      "version": "3.6.2",
+      "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.2.tgz",
+      "integrity": "sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw==",
       "dev": true
       "dev": true
     },
     },
     "uglify-js": {
     "uglify-js": {

+ 3 - 2
package.json

@@ -8,7 +8,8 @@
     "compile": "mrmdir ./release && npm run compile-amd && npm run compile-esm",
     "compile": "mrmdir ./release && npm run compile-amd && npm run compile-esm",
     "watch": "tsc -p ./src --watch",
     "watch": "tsc -p ./src --watch",
     "prepublishOnly": "npm run compile && node ./scripts/bundle && mcopy ./src/monaco.d.ts ./release/monaco.d.ts",
     "prepublishOnly": "npm run compile && node ./scripts/bundle && mcopy ./src/monaco.d.ts ./release/monaco.d.ts",
-    "import-typescript": "node ./scripts/importTypescript"
+    "import-typescript": "node ./scripts/importTypescript",
+    "run-nightly": "node ./scripts/runDaily"
   },
   },
   "author": "Microsoft Corporation",
   "author": "Microsoft Corporation",
   "license": "MIT",
   "license": "MIT",
@@ -24,7 +25,7 @@
     "monaco-languages": "^1.7.0",
     "monaco-languages": "^1.7.0",
     "monaco-plugin-helpers": "^1.0.2",
     "monaco-plugin-helpers": "^1.0.2",
     "requirejs": "^2.3.6",
     "requirejs": "^2.3.6",
-    "typescript": "^3.5.1",
+    "typescript": "^3.6.2",
     "uglify-js": "^3.4.9"
     "uglify-js": "^3.4.9"
   }
   }
 }
 }

+ 7 - 0
scripts/importTypescript.js

@@ -39,6 +39,12 @@ const TYPESCRIPT_LIB_DESTINATION = path.join(__dirname, '../src/lib');
 		tsServices.replace(/return require\(fileNameToRequire\);/, `// MONACOCHANGE\n            return undefined;\n            // END MONACOCHANGE`)
 		tsServices.replace(/return require\(fileNameToRequire\);/, `// MONACOCHANGE\n            return undefined;\n            // END MONACOCHANGE`)
 	);
 	);
 
 
+	// Make sure process.args don't get called in the browser, this
+	// should only happen in TS 2.6.2
+	const beforeProcess = `ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(process.argv));`
+	const afterProcess = `// MONACOCHANGE\n    ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify([]));\n// END MONACOCHANGE`
+	tsServices = tsServices.replace(beforeProcess, afterProcess);
+
 	var tsServices_amd = tsServices +
 	var tsServices_amd = tsServices +
 		`
 		`
 // MONACOCHANGE
 // MONACOCHANGE
@@ -73,6 +79,7 @@ export = ts;
 // END MONACOCHANGE
 // END MONACOCHANGE
 `;
 `;
 	fs.writeFileSync(path.join(TYPESCRIPT_LIB_DESTINATION, 'typescriptServices.d.ts'), dtsServices);
 	fs.writeFileSync(path.join(TYPESCRIPT_LIB_DESTINATION, 'typescriptServices.d.ts'), dtsServices);
+
 })();
 })();
 
 
 function importLibs() {
 function importLibs() {

+ 29 - 0
scripts/runDaily.js

@@ -0,0 +1,29 @@
+// @ts-check
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+
+const { execSync } = require("child_process");
+const { join } = require("path");
+const { readFileSync, writeFileSync } = require("fs");
+
+// Update to the daily build
+execSync("npm install --save typescript@next");
+
+// Update the dts files
+execSync("npm run import-typescript");
+
+// Sync the versions
+const packagePath = join(__dirname, "../package.json");
+const package = JSON.parse(readFileSync(packagePath, "utf8"));
+
+const tsPackagePath = join(__dirname, "../node_modules/typescript/package.json");
+const tsPackage = JSON.parse(readFileSync(tsPackagePath, "utf8"));
+
+// Set the monaco-typescript version to directly match the typescript nightly version
+package.version = tsPackage.version;
+writeFileSync(packagePath, JSON.stringify(package), "utf8");
+
+// Update the dts files
+execSync("npm run compile");

+ 21 - 18
src/languageFeatures.ts

@@ -23,26 +23,29 @@ enum IndentStyle {
 	Smart = 2
 	Smart = 2
 }
 }
 
 
-function flattenDiagnosticMessageText(messageText: string | ts.DiagnosticMessageChain, newLine: '\n'): string {
-	if (typeof messageText === "string") {
-		return messageText;
-	} else {
-		let diagnosticChain = messageText;
-		let result = "";
-		let indent = 0;
-		while (diagnosticChain) {
-			if (indent) {
-				result += newLine;
-				for (let i = 0; i < indent; i++) {
-					result += "  ";
-				}
-			}
-			result += diagnosticChain.messageText;
-			indent++;
-			diagnosticChain = diagnosticChain.next;
+export function flattenDiagnosticMessageText(diag: string | ts.DiagnosticMessageChain | undefined, newLine: string, indent = 0): string {
+	if (typeof diag === "string") {
+		return diag;
+	}
+	else if (diag === undefined) {
+		return "";
+	}
+	let result = "";
+	if (indent) {
+		result += newLine;
+
+		for (let i = 0; i < indent; i++) {
+			result += "  ";
+		}
+	}
+	result += diag.messageText;
+	indent++;
+	if (diag.next) {
+		for (const kid of diag.next) {
+			result += flattenDiagnosticMessageText(kid, newLine, indent);
 		}
 		}
-		return result;
 	}
 	}
+	return result;
 }
 }
 
 
 function displayPartsToString(displayParts: ts.SymbolDisplayPart[]): string {
 function displayPartsToString(displayParts: ts.SymbolDisplayPart[]): string {

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
src/lib/lib.ts


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 239 - 98
src/lib/typescriptServices-amd.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 4 - 5
src/lib/typescriptServices.d.ts


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 239 - 98
src/lib/typescriptServices.js


+ 9 - 3
src/monaco.contribution.ts

@@ -152,18 +152,21 @@ enum ModuleKind {
 	UMD = 3,
 	UMD = 3,
 	System = 4,
 	System = 4,
 	ES2015 = 5,
 	ES2015 = 5,
-	ESNext = 6
+	ESNext = 99
 }
 }
+
 enum JsxEmit {
 enum JsxEmit {
 	None = 0,
 	None = 0,
 	Preserve = 1,
 	Preserve = 1,
 	React = 2,
 	React = 2,
 	ReactNative = 3
 	ReactNative = 3
 }
 }
+
 enum NewLineKind {
 enum NewLineKind {
 	CarriageReturnLineFeed = 0,
 	CarriageReturnLineFeed = 0,
 	LineFeed = 1
 	LineFeed = 1
 }
 }
+
 enum ScriptTarget {
 enum ScriptTarget {
 	ES3 = 0,
 	ES3 = 0,
 	ES5 = 1,
 	ES5 = 1,
@@ -171,10 +174,13 @@ enum ScriptTarget {
 	ES2016 = 3,
 	ES2016 = 3,
 	ES2017 = 4,
 	ES2017 = 4,
 	ES2018 = 5,
 	ES2018 = 5,
-	ESNext = 6,
+	ES2019 = 6,
+	ES2020 = 7,
+	ESNext = 99,
 	JSON = 100,
 	JSON = 100,
-	Latest = 6
+	Latest = ESNext,
 }
 }
+
 enum ModuleResolutionKind {
 enum ModuleResolutionKind {
 	Classic = 1,
 	Classic = 1,
 	NodeJs = 2
 	NodeJs = 2

+ 6 - 3
src/monaco.d.ts

@@ -8,8 +8,9 @@ declare module monaco.languages.typescript {
         UMD = 3,
         UMD = 3,
         System = 4,
         System = 4,
         ES2015 = 5,
         ES2015 = 5,
-        ESNext = 6
+        ESNext = 99
     }
     }
+
     enum JsxEmit {
     enum JsxEmit {
         None = 0,
         None = 0,
         Preserve = 1,
         Preserve = 1,
@@ -28,9 +29,11 @@ declare module monaco.languages.typescript {
         ES2016 = 3,
         ES2016 = 3,
         ES2017 = 4,
         ES2017 = 4,
         ES2018 = 5,
         ES2018 = 5,
-        ESNext = 6,
+        ES2019 = 6,
+        ES2020 = 7,
+        ESNext = 99,
         JSON = 100,
         JSON = 100,
-        Latest = 6
+        Latest = ESNext,
     }
     }
 
 
     export enum ModuleResolutionKind {
     export enum ModuleResolutionKind {

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio