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> {
@ -4758,180 +4763,180 @@ declare module monaco.worker {
} }
} }
declare module monaco.languages.typescript { declare module monaco.languages.typescript {
export enum ModuleKind { export enum ModuleKind {
None = 0, None = 0,
CommonJS = 1, CommonJS = 1,
AMD = 2, AMD = 2,
UMD = 3, UMD = 3,
System = 4, System = 4,
ES6 = 5, ES6 = 5,
ES2015 = 5, ES2015 = 5,
} }
export enum JsxEmit { export enum JsxEmit {
None = 0, None = 0,
Preserve = 1, Preserve = 1,
React = 2, React = 2,
} }
export enum NewLineKind { export enum NewLineKind {
CarriageReturnLineFeed = 0, CarriageReturnLineFeed = 0,
LineFeed = 1, LineFeed = 1,
} }
export enum ScriptTarget { export enum ScriptTarget {
ES3 = 0, ES3 = 0,
ES5 = 1, ES5 = 1,
ES6 = 2, ES6 = 2,
ES2015 = 2, ES2015 = 2,
Latest = 2, Latest = 2,
} }
export enum ModuleResolutionKind { export enum ModuleResolutionKind {
Classic = 1, Classic = 1,
NodeJs = 2, NodeJs = 2,
} }
interface CompilerOptions { interface CompilerOptions {
allowNonTsExtensions?: boolean; allowNonTsExtensions?: boolean;
charset?: string; charset?: string;
declaration?: boolean; declaration?: boolean;
diagnostics?: boolean; diagnostics?: boolean;
emitBOM?: boolean; emitBOM?: boolean;
help?: boolean; help?: boolean;
init?: boolean; init?: boolean;
inlineSourceMap?: boolean; inlineSourceMap?: boolean;
inlineSources?: boolean; inlineSources?: boolean;
jsx?: JsxEmit; jsx?: JsxEmit;
reactNamespace?: string; reactNamespace?: string;
listFiles?: boolean; listFiles?: boolean;
locale?: string; locale?: string;
mapRoot?: string; mapRoot?: string;
module?: ModuleKind; module?: ModuleKind;
newLine?: NewLineKind; newLine?: NewLineKind;
noEmit?: boolean; noEmit?: boolean;
noEmitHelpers?: boolean; noEmitHelpers?: boolean;
noEmitOnError?: boolean; noEmitOnError?: boolean;
noErrorTruncation?: boolean; noErrorTruncation?: boolean;
noImplicitAny?: boolean; noImplicitAny?: boolean;
noLib?: boolean; noLib?: boolean;
noResolve?: boolean; noResolve?: boolean;
out?: string; out?: string;
outFile?: string; outFile?: string;
outDir?: string; outDir?: string;
preserveConstEnums?: boolean; preserveConstEnums?: boolean;
project?: string; project?: string;
removeComments?: boolean; removeComments?: boolean;
rootDir?: string; rootDir?: string;
sourceMap?: boolean; sourceMap?: boolean;
sourceRoot?: string; sourceRoot?: string;
suppressExcessPropertyErrors?: boolean; suppressExcessPropertyErrors?: boolean;
suppressImplicitAnyIndexErrors?: boolean; suppressImplicitAnyIndexErrors?: boolean;
target?: ScriptTarget; target?: ScriptTarget;
version?: boolean; version?: boolean;
watch?: boolean; watch?: boolean;
isolatedModules?: boolean; isolatedModules?: boolean;
experimentalDecorators?: boolean; experimentalDecorators?: boolean;
emitDecoratorMetadata?: boolean; emitDecoratorMetadata?: boolean;
moduleResolution?: ModuleResolutionKind; moduleResolution?: ModuleResolutionKind;
allowUnusedLabels?: boolean; allowUnusedLabels?: boolean;
allowUnreachableCode?: boolean; allowUnreachableCode?: boolean;
noImplicitReturns?: boolean; noImplicitReturns?: boolean;
noFallthroughCasesInSwitch?: boolean; noFallthroughCasesInSwitch?: boolean;
forceConsistentCasingInFileNames?: boolean; forceConsistentCasingInFileNames?: boolean;
allowSyntheticDefaultImports?: boolean; allowSyntheticDefaultImports?: boolean;
allowJs?: boolean; allowJs?: boolean;
noImplicitUseStrict?: boolean; noImplicitUseStrict?: boolean;
disableSizeLimit?: boolean; disableSizeLimit?: boolean;
[option: string]: string | number | boolean; [option: string]: string | number | boolean;
} }
export interface DiagnosticsOptions { export interface DiagnosticsOptions {
noSemanticValidation?: boolean; noSemanticValidation?: boolean;
noSyntaxValidation?: boolean; noSyntaxValidation?: boolean;
} }
export interface LanguageServiceDefaults { export interface LanguageServiceDefaults {
/** /**
* Add an additional source file to the language service. Use this * Add an additional source file to the language service. Use this
* for typescript (definition) files that won't be loaded as editor * for typescript (definition) files that won't be loaded as editor
* document, like `jquery.d.ts`. * document, like `jquery.d.ts`.
* *
* @param content The file content * @param content The file content
* @param filePath An optional file path * @param filePath An optional file path
* @returns A disposabled which will remove the file from the * @returns A disposabled which will remove the file from the
* language service upon disposal. * language service upon disposal.
*/ */
addExtraLib(content: string, filePath?: string): IDisposable; addExtraLib(content: string, filePath?: string): IDisposable;
/** /**
* Set TypeScript compiler options. * Set TypeScript compiler options.
*/ */
setCompilerOptions(options: CompilerOptions): void; setCompilerOptions(options: CompilerOptions): void;
/** /**
* Configure whether syntactic and/or semantic validation should * Configure whether syntactic and/or semantic validation should
* be performed * be performed
*/ */
setDiagnosticsOptions(options: DiagnosticsOptions): void; setDiagnosticsOptions(options: DiagnosticsOptions): void;
/** /**
* Configure when the worker shuts down. By default that is 2mins. * Configure when the worker shuts down. By default that is 2mins.
* *
* @param value The maximun idle time in milliseconds. Values less than one * @param value The maximun idle time in milliseconds. Values less than one
* mean never shut down. * mean never shut down.
*/ */
setMaximunWorkerIdleTime(value: number): void; setMaximunWorkerIdleTime(value: number): void;
} }
export var typescriptDefaults: LanguageServiceDefaults; export var typescriptDefaults: LanguageServiceDefaults;
export var javascriptDefaults: LanguageServiceDefaults; export var javascriptDefaults: LanguageServiceDefaults;
export var getTypeScriptWorker: () => monaco.Promise<any>; export var getTypeScriptWorker: () => monaco.Promise<any>;
export var getJavaScriptWorker: () => monaco.Promise<any>; export var getJavaScriptWorker: () => monaco.Promise<any>;
} }
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
declare module monaco.languages.css { declare module monaco.languages.css {
export interface DiagnosticsOptions { export interface DiagnosticsOptions {
readonly validate?: boolean; readonly validate?: boolean;
readonly lint?: { readonly lint?: {
readonly compatibleVendorPrefixes?: 'ignore' | 'warning' | 'error', readonly compatibleVendorPrefixes?: 'ignore' | 'warning' | 'error',
readonly vendorPrefix?: 'ignore' | 'warning' | 'error', readonly vendorPrefix?: 'ignore' | 'warning' | 'error',
readonly duplicateProperties?: 'ignore' | 'warning' | 'error', readonly duplicateProperties?: 'ignore' | 'warning' | 'error',
readonly emptyRules?: 'ignore' | 'warning' | 'error', readonly emptyRules?: 'ignore' | 'warning' | 'error',
readonly importStatement?: 'ignore' | 'warning' | 'error', readonly importStatement?: 'ignore' | 'warning' | 'error',
readonly boxModel?: 'ignore' | 'warning' | 'error', readonly boxModel?: 'ignore' | 'warning' | 'error',
readonly universalSelector?: 'ignore' | 'warning' | 'error', readonly universalSelector?: 'ignore' | 'warning' | 'error',
readonly zeroUnits?: 'ignore' | 'warning' | 'error', readonly zeroUnits?: 'ignore' | 'warning' | 'error',
readonly fontFaceProperties?: 'ignore' | 'warning' | 'error', readonly fontFaceProperties?: 'ignore' | 'warning' | 'error',
readonly hexColorLength?: 'ignore' | 'warning' | 'error', readonly hexColorLength?: 'ignore' | 'warning' | 'error',
readonly argumentsInColorFunction?: 'ignore' | 'warning' | 'error', readonly argumentsInColorFunction?: 'ignore' | 'warning' | 'error',
readonly unknownProperties?: 'ignore' | 'warning' | 'error', readonly unknownProperties?: 'ignore' | 'warning' | 'error',
readonly ieHack?: 'ignore' | 'warning' | 'error', readonly ieHack?: 'ignore' | 'warning' | 'error',
readonly unknownVendorSpecificProperties?: 'ignore' | 'warning' | 'error', readonly unknownVendorSpecificProperties?: 'ignore' | 'warning' | 'error',
readonly propertyIgnoredDueToDisplay?: 'ignore' | 'warning' | 'error', readonly propertyIgnoredDueToDisplay?: 'ignore' | 'warning' | 'error',
readonly important?: 'ignore' | 'warning' | 'error', readonly important?: 'ignore' | 'warning' | 'error',
readonly float?: 'ignore' | 'warning' | 'error', readonly float?: 'ignore' | 'warning' | 'error',
readonly idSelector?: 'ignore' | 'warning' | 'error' readonly idSelector?: 'ignore' | 'warning' | 'error'
} }
} }
export interface LanguageServiceDefaults { export interface LanguageServiceDefaults {
readonly onDidChange: IEvent<LanguageServiceDefaults>; readonly onDidChange: IEvent<LanguageServiceDefaults>;
readonly diagnosticsOptions: DiagnosticsOptions; readonly diagnosticsOptions: DiagnosticsOptions;
setDiagnosticsOptions(options: DiagnosticsOptions): void; setDiagnosticsOptions(options: DiagnosticsOptions): void;
} }
export var cssDefaults: LanguageServiceDefaults; export var cssDefaults: LanguageServiceDefaults;
export var lessDefaults: LanguageServiceDefaults; export var lessDefaults: LanguageServiceDefaults;
export var scssDefaults: LanguageServiceDefaults; export var scssDefaults: LanguageServiceDefaults;
} }
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.