Also generate a top level monaco.d.ts

This commit is contained in:
Alex Dima 2016-10-21 11:29:43 +02:00
parent 77e9dcdca4
commit 564d195403
3 changed files with 5227 additions and 167 deletions

View file

@ -163,14 +163,43 @@ function addPluginDTS() {
} }
}); });
contents += '\n' + extraContent.join('\n'); contents = [
'/*!-----------------------------------------------------------',
' * Copyright (c) Microsoft Corporation. All rights reserved.',
' * Type definitions for monaco-editor v'+MONACO_EDITOR_VERSION,
' * Released under the MIT license',
'*-----------------------------------------------------------*/',
].join('\n') + '\n' + contents + '\n' + extraContent.join('\n');
// Ensure consistent indentation and line endings
contents = cleanFile(contents);
data.contents = new Buffer(contents); data.contents = new Buffer(contents);
fs.writeFileSync('website/playground/monaco.d.ts.txt', contents); fs.writeFileSync('website/playground/monaco.d.ts.txt', contents);
fs.writeFileSync('monaco.d.ts', contents);
this.emit('data', data); this.emit('data', data);
}); });
} }
/**
* Normalize line endings and ensure consistent 4 spaces indentation
*/
function cleanFile(contents) {
return contents.split(/\r\n|\r|\n/).map(function(line) {
var m = line.match(/^(\t+)/);
if (!m) {
return line;
}
var tabsCount = m[1].length;
var newIndent = '';
for (var i = 0; i < 4 * tabsCount; i++) {
newIndent += ' ';
}
return newIndent + line.substring(tabsCount);
}).join('\n');
}
/** /**
* Edit ThirdPartyNotices.txt: * Edit ThirdPartyNotices.txt:
* - append ThirdPartyNotices.txt from plugins * - append ThirdPartyNotices.txt from plugins

5026
monaco.d.ts vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,8 @@
/*!-----------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Type definitions for monaco-editor v0.7.0
* Released under the MIT license
*-----------------------------------------------------------*/
declare module monaco { declare module monaco {
interface Thenable<R> { interface Thenable<R> {