Răsfoiți Sursa

Ship better typings file

Alex Dima 7 ani în urmă
părinte
comite
c6192de715
5 a modificat fișierele cu 7978 adăugiri și 7936 ștergeri
  1. 41 1
      gulpfile.js
  2. 3966 3965
      monaco.d.ts
  3. 3 3
      package-lock.json
  4. 2 2
      package.json
  5. 3966 3965
      website/playground/monaco.d.ts.txt

+ 41 - 1
gulpfile.js

@@ -393,7 +393,9 @@ function addPluginDTS() {
 			var pluginPath = plugin.paths[`npm/min`]; // npm/dev or npm/min
 			var dtsPath = path.join(pluginPath, '../monaco.d.ts');
 			try {
-				extraContent.push(fs.readFileSync(dtsPath).toString());
+				let plugindts = fs.readFileSync(dtsPath).toString();
+				plugindts = plugindts.replace('declare module', 'declare namespace');
+				extraContent.push(plugindts);
 			} catch (err) {
 				return;
 			}
@@ -412,6 +414,44 @@ function addPluginDTS() {
 
 		data.contents = new Buffer(contents);
 
+		{
+			let lines = contents.split('\n');
+			let killNextCloseCurlyBrace = false;
+			for (let i = 0; i < lines.length; i++) {
+				let line = lines[i];
+
+				if (killNextCloseCurlyBrace) {
+					if ('}' === line) {
+						lines[i] = '';
+						killNextCloseCurlyBrace = false;
+						continue;
+					}
+
+					if (line.indexOf('    ') === 0) {
+						lines[i] = line.substr(4);
+					}
+
+					continue;
+				}
+
+				if ('declare namespace monaco {' === line) {
+					lines[i] = '';
+					killNextCloseCurlyBrace = true;
+					continue;
+				}
+
+				if (line.indexOf('declare namespace monaco.') === 0) {
+					lines[i] = line.replace('declare namespace monaco.', 'export namespace ');
+				}
+			}
+
+			this.emit('data', new File({
+				path: path.join(path.dirname(data.path), 'esm/vs/editor/editor.api.d.ts'),
+				base: data.base,
+				contents: new Buffer(lines.join('\n'))
+			}));
+		}
+
 		fs.writeFileSync('website/playground/monaco.d.ts.txt', contents);
 		fs.writeFileSync('monaco.d.ts', contents);
 		this.emit('data', data);

Fișier diff suprimat deoarece este prea mare
+ 3966 - 3965
monaco.d.ts


+ 3 - 3
package-lock.json

@@ -2377,9 +2377,9 @@
       "dev": true
     },
     "monaco-editor-core": {
-      "version": "0.11.3",
-      "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.11.3.tgz",
-      "integrity": "sha512-e6o/TInK+sRgWaWNj8kIaNinfmTC1vQdwF6QUaZ7h0OT+xILM6zxl+4B0imIbKm7iBYSZR2avH8Hbg8h6qQ2+g==",
+      "version": "0.11.4",
+      "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.11.4.tgz",
+      "integrity": "sha512-9kGuoLy55omwhQ2+HeLDbykc8rwaTaj8WEBGR8YNZ3SyMTofU6i6W3GyAz65etJ6blCGk8s0RsCJNm2JcWRRcA==",
       "dev": true
     },
     "monaco-html": {

+ 2 - 2
package.json

@@ -10,7 +10,7 @@
     "release": "gulp release",
     "website": "gulp website"
   },
-  "typings": "./monaco.d.ts",
+  "typings": "./esm/vs/editor/editor.api.d.ts",
   "module": "./esm/vs/editor/editor.main.js",
   "repository": {
     "type": "git",
@@ -23,7 +23,7 @@
     "gulp-typedoc": "^2.0.0",
     "http-server": "^0.11.1",
     "monaco-css": "2.0.1",
-    "monaco-editor-core": "0.11.3",
+    "monaco-editor-core": "0.11.4",
     "monaco-html": "2.0.2",
     "monaco-json": "2.0.1",
     "monaco-languages": "1.0.2",

Fișier diff suprimat deoarece este prea mare
+ 3966 - 3965
website/playground/monaco.d.ts.txt


Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff