Merge pull request #90682 from microsoft/joh/es6

ES6 everywhere
This commit is contained in:
Johannes Rieken 2020-03-02 15:18:52 +01:00 committed by GitHub
commit c3efba96a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 65 additions and 1025 deletions

View file

@ -72,11 +72,6 @@ const extractEditorSrcTask = task.define('extract-editor-src', () => {
apiusages,
extrausages
],
libs: [
`lib.es5.d.ts`,
`lib.dom.d.ts`,
`lib.webworker.importscripts.d.ts`
],
shakeLevel: 2, // 0-Files, 1-InnerFile, 2-ClassMembers
importIgnorePattern: /(^vs\/css!)|(promise-polyfill\/polyfill)/,
destRoot: path.join(root, 'out-editor-src'),

View file

@ -76,11 +76,7 @@ function createTypeScriptLanguageService(options) {
FILES[typing] = fs.readFileSync(filePath).toString();
});
// Resolve libs
const RESOLVED_LIBS = {};
options.libs.forEach((filename) => {
const filepath = path.join(TYPESCRIPT_LIB_FOLDER, filename);
RESOLVED_LIBS[`defaultLib:${filename}`] = fs.readFileSync(filepath).toString();
});
const RESOLVED_LIBS = processLibFiles(options);
const compilerOptions = ts.convertCompilerOptionsFromJson(options.compilerOptions, options.sourcesRoot).options;
const host = new TypeScriptLanguageServiceHost(RESOLVED_LIBS, FILES, compilerOptions);
return ts.createLanguageService(host);
@ -138,6 +134,29 @@ function discoverAndReadFiles(options) {
}
return FILES;
}
/**
* Read lib files and follow lib references
*/
function processLibFiles(options) {
const stack = [...options.compilerOptions.lib];
const result = {};
while (stack.length > 0) {
const filename = `lib.${stack.shift().toLowerCase()}.d.ts`;
const key = `defaultLib:${filename}`;
if (!result[key]) {
// add this file
const filepath = path.join(TYPESCRIPT_LIB_FOLDER, filename);
const sourceText = fs.readFileSync(filepath).toString();
result[key] = sourceText;
// precess dependencies and "recurse"
const info = ts.preProcessFile(sourceText);
for (let ref of info.libReferenceDirectives) {
stack.push(ref.fileName);
}
}
}
return result;
}
/**
* A TypeScript language service host
*/

View file

@ -18,7 +18,7 @@ export const enum ShakeLevel {
}
export function toStringShakeLevel(shakeLevel: ShakeLevel): string {
switch(shakeLevel) {
switch (shakeLevel) {
case ShakeLevel.Files:
return 'Files (0)';
case ShakeLevel.InnerFile:
@ -42,11 +42,6 @@ export interface ITreeShakingOptions {
* Inline usages.
*/
inlineEntryPoints: string[];
/**
* TypeScript libs.
* e.g. `lib.d.ts`, `lib.es2015.collection.d.ts`
*/
libs: string[];
/**
* Other .d.ts files
*/
@ -130,11 +125,7 @@ function createTypeScriptLanguageService(options: ITreeShakingOptions): ts.Langu
});
// Resolve libs
const RESOLVED_LIBS: ILibMap = {};
options.libs.forEach((filename) => {
const filepath = path.join(TYPESCRIPT_LIB_FOLDER, filename);
RESOLVED_LIBS[`defaultLib:${filename}`] = fs.readFileSync(filepath).toString();
});
const RESOLVED_LIBS = processLibFiles(options);
const compilerOptions = ts.convertCompilerOptionsFromJson(options.compilerOptions, options.sourcesRoot).options;
@ -205,6 +196,34 @@ function discoverAndReadFiles(options: ITreeShakingOptions): IFileMap {
return FILES;
}
/**
* Read lib files and follow lib references
*/
function processLibFiles(options: ITreeShakingOptions): ILibMap {
const stack: string[] = [...options.compilerOptions.lib];
const result: ILibMap = {};
while (stack.length > 0) {
const filename = `lib.${stack.shift()!.toLowerCase()}.d.ts`;
const key = `defaultLib:${filename}`;
if (!result[key]) {
// add this file
const filepath = path.join(TYPESCRIPT_LIB_FOLDER, filename);
const sourceText = fs.readFileSync(filepath).toString();
result[key] = sourceText;
// precess dependencies and "recurse"
const info = ts.preProcessFile(sourceText);
for (let ref of info.libReferenceDirectives) {
stack.push(ref.fileName);
}
}
}
return result;
}
interface ILibMap { [libName: string]: string; }
interface IFileMap { [fileName: string]: string; }
@ -475,7 +494,7 @@ function markNodes(languageService: ts.LanguageService, options: ITreeShakingOpt
}
if (black_queue.length === 0) {
for (let i = 0; i< gray_queue.length; i++) {
for (let i = 0; i < gray_queue.length; i++) {
const node = gray_queue[i];
const nodeParent = node.parent;
if ((ts.isClassDeclaration(nodeParent) || ts.isInterfaceDeclaration(nodeParent)) && nodeOrChildIsBlack(nodeParent)) {

View file

@ -12,6 +12,13 @@
"vs/*": [
"./vs/*"
]
}
},
"lib": [
"ES2015",
"ES2018.Promise",
"DOM",
"DOM.Iterable",
"WebWorker.ImportScripts"
]
}
}

View file

@ -6,11 +6,6 @@
"sourceMap": false,
"outDir": "../out",
"target": "es2017",
"lib": [
"dom",
"es5",
"es2015.iterable"
],
"types": [
"keytar",
"mocha",
@ -22,8 +17,5 @@
"include": [
"./typings",
"./vs"
],
"exclude": [
"./typings/es6-promise.d.ts"
]
}

View file

@ -8,17 +8,14 @@
"moduleResolution": "classic",
"removeComments": false,
"preserveConstEnums": true,
"target": "es5",
"target": "es6",
"sourceMap": false,
"declaration": true
},
"include": [
"typings/require.d.ts",
"typings/thenable.d.ts",
"typings/es6-promise.d.ts",
"typings/lib.es2018.promise.d.ts",
"typings/lib.array-ext.d.ts",
"typings/lib.ie11_safe_es6.d.ts",
"vs/css.d.ts",
"vs/monaco.d.ts",
"vs/nls.d.ts",

View file

@ -1,29 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// from TypeScript: lib.es2015.proxy.d.ts
interface ProxyHandler<T extends object> {
getPrototypeOf?(target: T): object | null;
setPrototypeOf?(target: T, v: any): boolean;
isExtensible?(target: T): boolean;
preventExtensions?(target: T): boolean;
getOwnPropertyDescriptor?(target: T, p: PropertyKey): PropertyDescriptor | undefined;
has?(target: T, p: PropertyKey): boolean;
get?(target: T, p: PropertyKey, receiver: any): any;
set?(target: T, p: PropertyKey, value: any, receiver: any): boolean;
deleteProperty?(target: T, p: PropertyKey): boolean;
defineProperty?(target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean;
enumerate?(target: T): PropertyKey[];
ownKeys?(target: T): PropertyKey[];
apply?(target: T, thisArg: any, argArray?: any): any;
construct?(target: T, argArray: any, newTarget?: any): object;
}
interface ProxyConstructor {
revocable<T extends object>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
new <T extends object>(target: T, handler: ProxyHandler<T>): T;
}
declare var Proxy: ProxyConstructor;

View file

@ -1,89 +0,0 @@
// Type definitions for es6-promise
// Project: https://github.com/jakearchibald/ES6-Promise
// Definitions by: François de Campredon <https://github.com/fdecampredon/>, vvakame <https://github.com/vvakame>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Thenable<T> {
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
}
declare class Promise<T> implements Thenable<T> {
/**
* If you call resolve in the body of the callback passed to the constructor,
* your promise is fulfilled with result object passed to resolve.
* If you call reject your promise is rejected with the object passed to reject.
* For consistency and debugging (eg stack traces), obj should be an instanceof Error.
* Any errors thrown in the constructor callback will be implicitly passed to reject().
*/
constructor(callback: (resolve: (value?: T | Thenable<T>) => void, reject: (error?: any) => void) => void);
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
*
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => void): Promise<U>;
/**
* Sugar for promise.then(undefined, onRejected)
*
* @param onRejected called when/if "promise" rejects
*/
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
}
declare namespace Promise {
/**
* Make a new promise from the thenable.
* A thenable is promise-like in as far as it has a "then" method.
*/
function resolve<T>(value: T | Thenable<T>): Promise<T>;
/**
*
*/
function resolve(): Promise<void>;
/**
* Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
*/
function reject(error: any): Promise<any>;
function reject<T>(error: T): Promise<T>;
/**
* Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
* the array passed to all can be a mixture of promise-like objects and other objects.
* The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
*/
function all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable<T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>, T9 | Thenable<T9>, T10 | Thenable<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
function all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable<T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>, T9 | Thenable<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
function all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable<T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
function all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable<T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
function all<T1, T2, T3, T4, T5, T6>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable<T4>, T5 | Thenable<T5>, T6 | Thenable<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
function all<T1, T2, T3, T4, T5>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable<T4>, T5 | Thenable<T5>]): Promise<[T1, T2, T3, T4, T5]>;
function all<T1, T2, T3, T4>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable<T4>]): Promise<[T1, T2, T3, T4]>;
function all<T1, T2, T3>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>]): Promise<[T1, T2, T3]>;
function all<T1, T2>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>]): Promise<[T1, T2]>;
function all<T>(values: (T | Thenable<T>)[]): Promise<T[]>;
/**
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
*/
function race<T>(promises: (T | Thenable<T>)[]): Promise<T>;
}
declare module 'es6-promise' {
var foo: typeof Promise; // Temp variable to reference Promise in local context
namespace rsvp {
export var Promise: typeof foo;
export function polyfill(): void;
}
export = rsvp;
}

View file

@ -1,27 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/**
* Represents the completion of an asynchronous operation
*/
interface Promise<T> {
/**
* Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
* resolved value cannot be modified from the callback.
* @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
* @returns A Promise for the completion of the callback.
*/
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
}

View file

@ -1,821 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// Defined a subset of ES6 built ins that run in IE11
// CHECK WITH http://kangax.github.io/compat-table/es6/#ie11
interface Map<K, V> {
clear(): void;
delete(key: K): boolean;
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
get(key: K): V | undefined;
has(key: K): boolean;
set(key: K, value: V): Map<K, V>;
readonly size: number;
// not supported on IE11:
// entries(): IterableIterator<[K, V]>;
// keys(): IterableIterator<K>;
// values(): IterableIterator<V>;
// [Symbol.iterator]():IterableIterator<[K,V]>;
// [Symbol.toStringTag]: string;
}
interface MapConstructor {
new <K, V>(): Map<K, V>;
readonly prototype: Map<any, any>;
// not supported on IE11:
// new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
}
declare var Map: MapConstructor;
interface Set<T> {
add(value: T): Set<T>;
clear(): void;
delete(value: T): boolean;
forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void;
has(value: T): boolean;
readonly size: number;
// not supported on IE11:
// entries(): IterableIterator<[T, T]>;
// keys(): IterableIterator<T>;
// values(): IterableIterator<T>;
// [Symbol.iterator]():IterableIterator<T>;
// [Symbol.toStringTag]: string;
}
interface SetConstructor {
new <T>(): Set<T>;
readonly prototype: Set<any>;
// not supported on IE11:
// new <T>(iterable: Iterable<T>): Set<T>;
}
declare var Set: SetConstructor;
interface WeakMap<K extends object, V> {
delete(key: K): boolean;
get(key: K): V | undefined;
has(key: K): boolean;
// IE11 doesn't return this
// set(key: K, value?: V): this;
set(key: K, value?: V): undefined;
}
interface WeakMapConstructor {
new(): WeakMap<any, any>;
new <K extends object, V>(): WeakMap<K, V>;
// new <K, V>(entries?: [K, V][]): WeakMap<K, V>;
readonly prototype: WeakMap<object, any>;
}
declare var WeakMap: WeakMapConstructor;
// /**
// * Represents a raw buffer of binary data, which is used to store data for the
// * different typed arrays. ArrayBuffers cannot be read from or written to directly,
// * but can be passed to a typed array or DataView Object to interpret the raw
// * buffer as needed.
// */
// interface ArrayBuffer {
// /**
// * Read-only. The length of the ArrayBuffer (in bytes).
// */
// readonly byteLength: number;
// /**
// * Returns a section of an ArrayBuffer.
// */
// slice(begin: number, end?: number): ArrayBuffer;
// }
// interface ArrayBufferConstructor {
// readonly prototype: ArrayBuffer;
// new (byteLength: number): ArrayBuffer;
// isView(arg: any): arg is ArrayBufferView;
// }
// declare const ArrayBuffer: ArrayBufferConstructor;
// interface ArrayBufferView {
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// byteOffset: number;
// }
// interface DataView {
// readonly buffer: ArrayBuffer;
// readonly byteLength: number;
// readonly byteOffset: number;
// /**
// * Gets the Float32 value at the specified byte offset from the start of the view. There is
// * no alignment constraint; multi-byte values may be fetched from any offset.
// * @param byteOffset The place in the buffer at which the value should be retrieved.
// */
// getFloat32(byteOffset: number, littleEndian?: boolean): number;
// /**
// * Gets the Float64 value at the specified byte offset from the start of the view. There is
// * no alignment constraint; multi-byte values may be fetched from any offset.
// * @param byteOffset The place in the buffer at which the value should be retrieved.
// */
// getFloat64(byteOffset: number, littleEndian?: boolean): number;
// /**
// * Gets the Int8 value at the specified byte offset from the start of the view. There is
// * no alignment constraint; multi-byte values may be fetched from any offset.
// * @param byteOffset The place in the buffer at which the value should be retrieved.
// */
// getInt8(byteOffset: number): number;
// /**
// * Gets the Int16 value at the specified byte offset from the start of the view. There is
// * no alignment constraint; multi-byte values may be fetched from any offset.
// * @param byteOffset The place in the buffer at which the value should be retrieved.
// */
// getInt16(byteOffset: number, littleEndian?: boolean): number;
// /**
// * Gets the Int32 value at the specified byte offset from the start of the view. There is
// * no alignment constraint; multi-byte values may be fetched from any offset.
// * @param byteOffset The place in the buffer at which the value should be retrieved.
// */
// getInt32(byteOffset: number, littleEndian?: boolean): number;
// /**
// * Gets the Uint8 value at the specified byte offset from the start of the view. There is
// * no alignment constraint; multi-byte values may be fetched from any offset.
// * @param byteOffset The place in the buffer at which the value should be retrieved.
// */
// getUint8(byteOffset: number): number;
// /**
// * Gets the Uint16 value at the specified byte offset from the start of the view. There is
// * no alignment constraint; multi-byte values may be fetched from any offset.
// * @param byteOffset The place in the buffer at which the value should be retrieved.
// */
// getUint16(byteOffset: number, littleEndian?: boolean): number;
// /**
// * Gets the Uint32 value at the specified byte offset from the start of the view. There is
// * no alignment constraint; multi-byte values may be fetched from any offset.
// * @param byteOffset The place in the buffer at which the value should be retrieved.
// */
// getUint32(byteOffset: number, littleEndian?: boolean): number;
// /**
// * Stores an Float32 value at the specified byte offset from the start of the view.
// * @param byteOffset The place in the buffer at which the value should be set.
// * @param value The value to set.
// * @param littleEndian If false or undefined, a big-endian value should be written,
// * otherwise a little-endian value should be written.
// */
// setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void;
// /**
// * Stores an Float64 value at the specified byte offset from the start of the view.
// * @param byteOffset The place in the buffer at which the value should be set.
// * @param value The value to set.
// * @param littleEndian If false or undefined, a big-endian value should be written,
// * otherwise a little-endian value should be written.
// */
// setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void;
// /**
// * Stores an Int8 value at the specified byte offset from the start of the view.
// * @param byteOffset The place in the buffer at which the value should be set.
// * @param value The value to set.
// */
// setInt8(byteOffset: number, value: number): void;
// /**
// * Stores an Int16 value at the specified byte offset from the start of the view.
// * @param byteOffset The place in the buffer at which the value should be set.
// * @param value The value to set.
// * @param littleEndian If false or undefined, a big-endian value should be written,
// * otherwise a little-endian value should be written.
// */
// setInt16(byteOffset: number, value: number, littleEndian?: boolean): void;
// /**
// * Stores an Int32 value at the specified byte offset from the start of the view.
// * @param byteOffset The place in the buffer at which the value should be set.
// * @param value The value to set.
// * @param littleEndian If false or undefined, a big-endian value should be written,
// * otherwise a little-endian value should be written.
// */
// setInt32(byteOffset: number, value: number, littleEndian?: boolean): void;
// /**
// * Stores an Uint8 value at the specified byte offset from the start of the view.
// * @param byteOffset The place in the buffer at which the value should be set.
// * @param value The value to set.
// */
// setUint8(byteOffset: number, value: number): void;
// /**
// * Stores an Uint16 value at the specified byte offset from the start of the view.
// * @param byteOffset The place in the buffer at which the value should be set.
// * @param value The value to set.
// * @param littleEndian If false or undefined, a big-endian value should be written,
// * otherwise a little-endian value should be written.
// */
// setUint16(byteOffset: number, value: number, littleEndian?: boolean): void;
// /**
// * Stores an Uint32 value at the specified byte offset from the start of the view.
// * @param byteOffset The place in the buffer at which the value should be set.
// * @param value The value to set.
// * @param littleEndian If false or undefined, a big-endian value should be written,
// * otherwise a little-endian value should be written.
// */
// setUint32(byteOffset: number, value: number, littleEndian?: boolean): void;
// }
// interface DataViewConstructor {
// new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;
// }
// declare const DataView: DataViewConstructor;
// /**
// * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
// * number of bytes could not be allocated an exception is raised.
// */
// interface Int8Array {
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// readonly buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// readonly byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// readonly byteOffset: number;
// /**
// * The length of the array.
// */
// readonly length: number;
// /**
// * Sets a value or an array of values.
// * @param index The index of the location to set.
// * @param value The value to set.
// */
// set(index: number, value: number): void;
// /**
// * Sets a value or an array of values.
// * @param array A typed or untyped array of values to set.
// * @param offset The index in the current array at which the values are to be written.
// */
// set(array: ArrayLike<number>, offset?: number): void;
// /**
// * Converts a number to a string by using the current locale.
// */
// toLocaleString(): string;
// /**
// * Returns a string representation of an array.
// */
// toString(): string;
// [index: number]: number;
// }
// interface Int8ArrayConstructor {
// readonly prototype: Int8Array;
// new (length: number): Int8Array;
// new (array: ArrayLike<number>): Int8Array;
// new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array;
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// }
// declare const Int8Array: Int8ArrayConstructor;
// /**
// * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the
// * requested number of bytes could not be allocated an exception is raised.
// */
// interface Uint8Array {
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// readonly buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// readonly byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// readonly byteOffset: number;
// /**
// * The length of the array.
// */
// readonly length: number;
// /**
// * Sets a value or an array of values.
// * @param index The index of the location to set.
// * @param value The value to set.
// */
// set(index: number, value: number): void;
// /**
// * Sets a value or an array of values.
// * @param array A typed or untyped array of values to set.
// * @param offset The index in the current array at which the values are to be written.
// */
// set(array: ArrayLike<number>, offset?: number): void;
// /**
// * Converts a number to a string by using the current locale.
// */
// toLocaleString(): string;
// /**
// * Returns a string representation of an array.
// */
// toString(): string;
// [index: number]: number;
// }
// interface Uint8ArrayConstructor {
// readonly prototype: Uint8Array;
// new (length: number): Uint8Array;
// new (array: ArrayLike<number>): Uint8Array;
// new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array;
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// }
// declare const Uint8Array: Uint8ArrayConstructor;
// /**
// * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the
// * requested number of bytes could not be allocated an exception is raised.
// */
// interface Int16Array {
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// readonly buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// readonly byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// readonly byteOffset: number;
// /**
// * The length of the array.
// */
// readonly length: number;
// /**
// * Sets a value or an array of values.
// * @param index The index of the location to set.
// * @param value The value to set.
// */
// set(index: number, value: number): void;
// /**
// * Sets a value or an array of values.
// * @param array A typed or untyped array of values to set.
// * @param offset The index in the current array at which the values are to be written.
// */
// set(array: ArrayLike<number>, offset?: number): void;
// /**
// * Converts a number to a string by using the current locale.
// */
// toLocaleString(): string;
// /**
// * Returns a string representation of an array.
// */
// toString(): string;
// [index: number]: number;
// }
// interface Int16ArrayConstructor {
// readonly prototype: Int16Array;
// new (length: number): Int16Array;
// new (array: ArrayLike<number>): Int16Array;
// new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array;
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// }
// declare const Int16Array: Int16ArrayConstructor;
// /**
// * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the
// * requested number of bytes could not be allocated an exception is raised.
// */
// interface Uint16Array {
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// readonly buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// readonly byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// readonly byteOffset: number;
// /**
// * The length of the array.
// */
// readonly length: number;
// /**
// * Sets a value or an array of values.
// * @param index The index of the location to set.
// * @param value The value to set.
// */
// set(index: number, value: number): void;
// /**
// * Sets a value or an array of values.
// * @param array A typed or untyped array of values to set.
// * @param offset The index in the current array at which the values are to be written.
// */
// set(array: ArrayLike<number>, offset?: number): void;
// /**
// * Converts a number to a string by using the current locale.
// */
// toLocaleString(): string;
// /**
// * Returns a string representation of an array.
// */
// toString(): string;
// [index: number]: number;
// }
// interface Uint16ArrayConstructor {
// readonly prototype: Uint16Array;
// new (length: number): Uint16Array;
// new (array: ArrayLike<number>): Uint16Array;
// new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array;
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// }
// declare const Uint16Array: Uint16ArrayConstructor;
// /**
// * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the
// * requested number of bytes could not be allocated an exception is raised.
// */
// interface Int32Array {
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// readonly buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// readonly byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// readonly byteOffset: number;
// /**
// * The length of the array.
// */
// readonly length: number;
// /**
// * Sets a value or an array of values.
// * @param index The index of the location to set.
// * @param value The value to set.
// */
// set(index: number, value: number): void;
// /**
// * Sets a value or an array of values.
// * @param array A typed or untyped array of values to set.
// * @param offset The index in the current array at which the values are to be written.
// */
// set(array: ArrayLike<number>, offset?: number): void;
// /**
// * Converts a number to a string by using the current locale.
// */
// toLocaleString(): string;
// /**
// * Returns a string representation of an array.
// */
// toString(): string;
// [index: number]: number;
// }
// interface Int32ArrayConstructor {
// readonly prototype: Int32Array;
// new (length: number): Int32Array;
// new (array: ArrayLike<number>): Int32Array;
// new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array;
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// }
// declare const Int32Array: Int32ArrayConstructor;
// /**
// * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the
// * requested number of bytes could not be allocated an exception is raised.
// */
// interface Uint32Array {
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// readonly buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// readonly byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// readonly byteOffset: number;
// /**
// * The length of the array.
// */
// readonly length: number;
// /**
// * Sets a value or an array of values.
// * @param index The index of the location to set.
// * @param value The value to set.
// */
// set(index: number, value: number): void;
// /**
// * Sets a value or an array of values.
// * @param array A typed or untyped array of values to set.
// * @param offset The index in the current array at which the values are to be written.
// */
// set(array: ArrayLike<number>, offset?: number): void;
// /**
// * Converts a number to a string by using the current locale.
// */
// toLocaleString(): string;
// /**
// * Returns a string representation of an array.
// */
// toString(): string;
// [index: number]: number;
// }
// interface Uint32ArrayConstructor {
// readonly prototype: Uint32Array;
// new (length: number): Uint32Array;
// new (array: ArrayLike<number>): Uint32Array;
// new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array;
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// }
// declare const Uint32Array: Uint32ArrayConstructor;
// /**
// * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number
// * of bytes could not be allocated an exception is raised.
// */
// interface Float32Array {
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// readonly buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// readonly byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// readonly byteOffset: number;
// /**
// * The length of the array.
// */
// readonly length: number;
// /**
// * Sets a value or an array of values.
// * @param index The index of the location to set.
// * @param value The value to set.
// */
// set(index: number, value: number): void;
// /**
// * Sets a value or an array of values.
// * @param array A typed or untyped array of values to set.
// * @param offset The index in the current array at which the values are to be written.
// */
// set(array: ArrayLike<number>, offset?: number): void;
// /**
// * Converts a number to a string by using the current locale.
// */
// toLocaleString(): string;
// /**
// * Returns a string representation of an array.
// */
// toString(): string;
// [index: number]: number;
// }
// interface Float32ArrayConstructor {
// readonly prototype: Float32Array;
// new (length: number): Float32Array;
// new (array: ArrayLike<number>): Float32Array;
// new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array;
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// }
// declare const Float32Array: Float32ArrayConstructor;
// /**
// * A typed array of 64-bit float values. The contents are initialized to 0. If the requested
// * number of bytes could not be allocated an exception is raised.
// */
// interface Float64Array {
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// readonly buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// readonly byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// readonly byteOffset: number;
// /**
// * The length of the array.
// */
// readonly length: number;
// /**
// * Sets a value or an array of values.
// * @param index The index of the location to set.
// * @param value The value to set.
// */
// set(index: number, value: number): void;
// /**
// * Sets a value or an array of values.
// * @param array A typed or untyped array of values to set.
// * @param offset The index in the current array at which the values are to be written.
// */
// set(array: ArrayLike<number>, offset?: number): void;
// /**
// * Converts a number to a string by using the current locale.
// */
// toLocaleString(): string;
// /**
// * Returns a string representation of an array.
// */
// toString(): string;
// [index: number]: number;
// }
// interface Float64ArrayConstructor {
// readonly prototype: Float64Array;
// new (length: number): Float64Array;
// new (array: ArrayLike<number>): Float64Array;
// new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array;
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// }
// declare const Float64Array: Float64ArrayConstructor;

View file

@ -1,23 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/////////////////////////////
/// WorkerGlobalScope APIs
/////////////////////////////
// These are only available in a Web Worker
declare function importScripts(...urls: string[]): void;

View file

@ -76,7 +76,7 @@ export class ExtensionHostMain {
// error forwarding and stack trace scanning
Error.stackTraceLimit = 100; // increase number of stack frames (from 10, https://github.com/v8/v8/wiki/Stack-Trace-API)
const extensionErrors = new WeakMap<Error, IExtensionDescription>();
const extensionErrors = new WeakMap<Error, IExtensionDescription | undefined>();
this._extensionService.getExtensionPathIndex().then(map => {
(<any>Error).prepareStackTrace = (error: Error, stackTrace: errors.V8CallSite[]) => {
let stackTraceMessage = '';